Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Imgur/image links are arent opened #48

Open
sirzento opened this issue Mar 28, 2022 · 5 comments
Open

Imgur/image links are arent opened #48

sirzento opened this issue Mar 28, 2022 · 5 comments
Labels

Comments

@sirzento
Copy link

Imgur links aren't vorwarded to the browser. Test link: https://i.imgur.com/U1Axo5n.png

@a1aw
Copy link
Owner

a1aw commented Mar 28, 2022

noticed, there's a problem with handling strings after the #47 update, will fix soon

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 28
        at java.lang.String.substring(String.java:1963)
        at com.github.mob41.osums.OsumsOldParser.checkVaildBeatmapUrl(OsumsOldParser.java:906)
        at com.github.mob41.osumer.launcher.Main.main(Main.java:201)

@a1aw
Copy link
Owner

a1aw commented Mar 28, 2022

There should be a modern and better way to prevent this from happening: version controls, CI, unit tests, etc.
But this old 5 years project is aging and the old code style is not satisfactory at all and hard to maintain.

There are so many things updated and changed during this 5 years. And many things deprecated such as Java 8, JavaFX is gone to be OpenJavaFX etc.

This software uses Java, which is not good at all in terms of performance and regular activation of the application. But rewriting this software into another language would be a hassle to me and I cannot get any advantages from it because I have stopped playing this game for so long.

I understand there's still a number of people using this software and it stopped working since the last changes to the osu! website. But I am starting to have a hard time maintaining this application.

I might write more about this in the ReadMe or a pinned issue soon to let people understand my situation right now.

@sirzento
Copy link
Author

Also, https://osu.ppy.sh/users/4304441 doesn't get opened in browser.

Ahh okey. but isn't it just a regex that checks the url if it is a valid beatmap link and if not then redirect this url to the browser?

@a1aw
Copy link
Owner

a1aw commented Mar 28, 2022

the changes from the last update causes an error that breaks everything when a single URL gets processed. Everything including but not limited to https://www.google.com
Also, see #50 to know more about the current state of this application

@a1aw a1aw added the bug label Mar 28, 2022
@sirzento
Copy link
Author

sirzento commented Mar 28, 2022

I just looked into your checkVaildBeatmapUrl function. I don't know all url's but aren't now all beatmap url's like "https://osu.ppy.sh/beatmapsets/000000#osu/0000000" (With 0 as placeholder) ?

Edit:
maybe you could just replace the whole function logic with an regex. That would look somethink like that ^https?:\/\/osu\.ppy\.sh\/beatmapsets\/\d+#(osu|taiko|fruits|mania)\/\d+. A few exaples: https://regex101.com/r/uUo6Vp/1

And because java the regex needs to look a bit differend. Here is an example code. Returns true if the link is a valid beatmap:

import java.util.regex.*;
    public boolean checkVaildBeatmapUrl(String url) {
        Pattern p = Pattern.compile("https?://osu\\.ppy\\.sh/beatmapsets/\\d+#(osu|taiko|fruits|mania)/\\d+");
        Matcher m = p.matcher(url);
        return m.matches();
    }

Edit:
Thats the wrong url. When clicking in osu you actually get an shorter url with an redirect. But the regex way does work

Because the current version of osumer doesn't run on 21h2, I did create a small c# app that just auto downloads and imports the beatmap but without any nice ui.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants