mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-19 14:47:36 -04:00
frontend: simplify the version pagination regex (#593)
Fixes #586 Depending on your javascript engine, you may or may not have support for lookaheads/lookbehinds. I took this regex from github's examples without thinking -- probably fine in all versions of `node` but of course some platforms it's not going to work. Simplify it to be a more typical regex.
This commit is contained in:
parent
12b81da339
commit
4c9a67ef03
|
@ -92,7 +92,7 @@ async function parseGithubRelease(githubRelease: any): Promise<ReleaseInfo> {
|
|||
}
|
||||
|
||||
export async function listOfficialReleases(): Promise<ReleaseInfo[]> {
|
||||
const nextUrlPattern = /(?<=<)([\S]*)(?=>; rel="Next")/i;
|
||||
const nextUrlPattern = /<([\S]+)>; rel="Next"/i;
|
||||
let releases = [];
|
||||
let urlToHit =
|
||||
"https://api.github.com/repos/open-goal/jak-project/releases?per_page=100";
|
||||
|
@ -117,7 +117,7 @@ export async function listOfficialReleases(): Promise<ReleaseInfo[]> {
|
|||
resp.headers.get("link").includes(`rel=\"next\"`)
|
||||
) {
|
||||
// we must paginate!
|
||||
urlToHit = resp.headers.get("link").match(nextUrlPattern)[0];
|
||||
urlToHit = resp.headers.get("link").match(nextUrlPattern)[1];
|
||||
} else {
|
||||
urlToHit = undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue