From f0e1399d5e3d9adeebca9d1a9794da1d81b83103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesse=20Keskel=C3=A4?= Date: Tue, 23 Dec 2025 13:16:44 +0200 Subject: [PATCH 1/6] chore: added Cursor to the extensions page (not available yet, but it will be available soon). --- public/images/cursor.svg | 32 ++++++++++++++++++++++++++++ public/locales/en/common.json | 1 + public/locales/fi/common.json | 3 ++- src/app/[locale]/authorize/page.tsx | 12 +++++++++-- src/app/[locale]/extensions/page.tsx | 7 ++++++ 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 public/images/cursor.svg diff --git a/public/images/cursor.svg b/public/images/cursor.svg new file mode 100644 index 00000000..1f8a7c33 --- /dev/null +++ b/public/images/cursor.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 62e8f1c5..909024f4 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -47,6 +47,7 @@ "neovim": "Download Testaustime for Neovim", "title": "Extensions", "vscode": "Download Testaustime for Visual Studio Code", + "cursor": "Download Testaustime for Cursor", "sublime": "Download Testaustime for Sublime Text" }, "footer": { diff --git a/public/locales/fi/common.json b/public/locales/fi/common.json index 759908dd..f7265abd 100644 --- a/public/locales/fi/common.json +++ b/public/locales/fi/common.json @@ -42,6 +42,7 @@ }, "extensions": { "body": "Lataa Testaustime-laajennus suosikkieditorillesi!", + "cursor": "Lataa Testaustime Cursor:lle", "intellij": "Lataa Testaustime IntelliJ:lle", "micro": "Lataa Testaustime Micro:lle", "neovim": "Lataa Testaustime Neovim:lle", @@ -308,7 +309,7 @@ } }, "authorize": { - "body": "Olet kirjautumassa sisään viralliseen Visual Studio Code -lisäosaan.", + "body": "Olet kirjautumassa sisään viralliseen {{editor}} -lisäosaan.", "continue": "Jatka käyttäjänä {{username}}", "notWorking": { "text": "Eikö toimi?", diff --git a/src/app/[locale]/authorize/page.tsx b/src/app/[locale]/authorize/page.tsx index b12adf9a..cbb612c1 100644 --- a/src/app/[locale]/authorize/page.tsx +++ b/src/app/[locale]/authorize/page.tsx @@ -18,6 +18,8 @@ export default async function AuthorizePage({ const loginUrl = editor == "vscode" ? `/login?redirect=${encodeURIComponent("/authorize?editor=vscode")}` + : editor == "" + ? `/login?redirect=${encodeURIComponent("/authorize?editor=cursor")}` : "/login"; const token = cookies().get("token")?.value; @@ -32,6 +34,8 @@ export default async function AuthorizePage({ const { username } = me; + const editorName = editor == "vscode" ? "Visual Studio Code" : "Cursor"; + return ( - {t("authorize.body")} + {t("authorize.body", { editor: editorName })} diff --git a/src/app/[locale]/extensions/page.tsx b/src/app/[locale]/extensions/page.tsx index 54451708..37dbb292 100644 --- a/src/app/[locale]/extensions/page.tsx +++ b/src/app/[locale]/extensions/page.tsx @@ -77,6 +77,13 @@ export default async function ExtensionsPage({ sourceCodeLink="https://github.com/Testausserveri/testaustime-vscode" text={t("extensions.vscode")} /> + Date: Tue, 23 Dec 2025 13:29:22 +0200 Subject: [PATCH 2/6] fix: changed the redirect uri back to cursor extension. --- src/app/[locale]/authorize/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/[locale]/authorize/page.tsx b/src/app/[locale]/authorize/page.tsx index cbb612c1..24a7ce42 100644 --- a/src/app/[locale]/authorize/page.tsx +++ b/src/app/[locale]/authorize/page.tsx @@ -50,7 +50,7 @@ export default async function AuthorizePage({ href={ editor == "vscode" ? `vscode://testausserveri-ry.testaustime/authorize?token=${token}` - : `cursor://testausserveri-ry.testaustime/authorize?token=${token}` + : `cursor://testausserveri-ry.testaustime-cursor/authorize?token=${token}` } > {t("authorize.continue", { username })} From b60a4f8fd814ff9e94ce86e5c74cf82d16cd1b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesse=20Keskel=C3=A4?= Date: Tue, 23 Dec 2025 14:01:27 +0200 Subject: [PATCH 3/6] chore: added cursor redirect url to the allowed redirects array. --- src/components/LoginForm/actions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/LoginForm/actions.ts b/src/components/LoginForm/actions.ts index 80219b96..6a5fbfd5 100644 --- a/src/components/LoginForm/actions.ts +++ b/src/components/LoginForm/actions.ts @@ -22,6 +22,7 @@ const allowedRedirects = [ "/friends", "/leaderboards", "/authorize?editor=vscode", + "/authorize?editor=cursor", ]; export const logIn = async ( From 52ff81275161f81e72c3575ed29181d0de03b1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesse=20Keskel=C3=A4?= Date: Tue, 23 Dec 2025 14:14:33 +0200 Subject: [PATCH 4/6] i forgot to add this here. now it's here. --- public/locales/en/common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 909024f4..aa549c53 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -309,7 +309,7 @@ } }, "authorize": { - "body": "You are logging in to the official Visual Studio Code extension.", + "body": "You are logging in to the official {{editor}} extension.", "continue": "Continue as {{username}}", "notWorking": { "text": "Not working?", From 441934afff94735fc3b215c81dac9625d0a81ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesse=20Keskel=C3=A4?= Date: Tue, 23 Dec 2025 14:25:12 +0200 Subject: [PATCH 5/6] chore: made changes based on the github pr comment written by Eldermarkki. --- src/app/[locale]/authorize/page.tsx | 36 ++++++++++++++++++---------- src/app/[locale]/extensions/page.tsx | 2 +- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/app/[locale]/authorize/page.tsx b/src/app/[locale]/authorize/page.tsx index 24a7ce42..74a50992 100644 --- a/src/app/[locale]/authorize/page.tsx +++ b/src/app/[locale]/authorize/page.tsx @@ -15,12 +15,18 @@ export default async function AuthorizePage({ }) { const { t } = await initTranslations(locale, ["common"]); - const loginUrl = - editor == "vscode" - ? `/login?redirect=${encodeURIComponent("/authorize?editor=vscode")}` - : editor == "" - ? `/login?redirect=${encodeURIComponent("/authorize?editor=cursor")}` - : "/login"; + const loginUrls = new Map( + Object.entries({ + vscode: `/login?redirect=${encodeURIComponent("/authorize?editor=vscode")}`, + cursor: `/login?redirect=${encodeURIComponent("/authorize?editor=cursor")}`, + }), + ); + const loginUrl = loginUrls.get(editor ?? "vscode"); + + if (loginUrl === undefined) { + // Make this prettier + return
Unsupported editor
; + } const token = cookies().get("token")?.value; if (!token) { @@ -34,7 +40,17 @@ export default async function AuthorizePage({ const { username } = me; - const editorName = editor == "vscode" ? "Visual Studio Code" : "Cursor"; + const editorNames = new Map( + Object.entries({ + vscode: "Visual Studio Code", + cursor: "Cursor", + }), + ); + const editorName = editorNames.get(editor ?? "vscode"); + + if (editorName === undefined) { + return
Invalid editor
; + } return ( @@ -47,11 +63,7 @@ export default async function AuthorizePage({ {t("authorize.body", { editor: editorName })} diff --git a/src/app/[locale]/extensions/page.tsx b/src/app/[locale]/extensions/page.tsx index 37dbb292..343058da 100644 --- a/src/app/[locale]/extensions/page.tsx +++ b/src/app/[locale]/extensions/page.tsx @@ -80,7 +80,7 @@ export default async function ExtensionsPage({ From 7f7c38c4cf77bf72440ad040908df95dd06f0ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesse=20Keskel=C3=A4?= Date: Fri, 26 Dec 2025 19:34:37 +0200 Subject: [PATCH 6/6] fix: added proper redirect urls back to extension. --- public/locales/en/common.json | 2 ++ public/locales/fi/common.json | 2 ++ src/app/[locale]/authorize/page.tsx | 18 +++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index aa549c53..7666fea9 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -310,6 +310,8 @@ }, "authorize": { "body": "You are logging in to the official {{editor}} extension.", + "invalidEditor": "This editor is invalid.", + "unsupportedEditor": "This editor is not supported.", "continue": "Continue as {{username}}", "notWorking": { "text": "Not working?", diff --git a/public/locales/fi/common.json b/public/locales/fi/common.json index f7265abd..5d07b743 100644 --- a/public/locales/fi/common.json +++ b/public/locales/fi/common.json @@ -310,6 +310,8 @@ }, "authorize": { "body": "Olet kirjautumassa sisään viralliseen {{editor}} -lisäosaan.", + "invalidEditor": "Tämä editori on virheellinen.", + "unsupportedEditor": "Tätä editoria ei tueta.", "continue": "Jatka käyttäjänä {{username}}", "notWorking": { "text": "Eikö toimi?", diff --git a/src/app/[locale]/authorize/page.tsx b/src/app/[locale]/authorize/page.tsx index 74a50992..9b4d73e1 100644 --- a/src/app/[locale]/authorize/page.tsx +++ b/src/app/[locale]/authorize/page.tsx @@ -25,7 +25,7 @@ export default async function AuthorizePage({ if (loginUrl === undefined) { // Make this prettier - return
Unsupported editor
; + return
{t("authorize.unsupportedEditor")}
; } const token = cookies().get("token")?.value; @@ -33,6 +33,18 @@ export default async function AuthorizePage({ redirect(loginUrl); } + const redirectUrls = new Map( + Object.entries({ + vscode: `vscode://testausserveri-ry.testaustime/authorize?token=${token}`, + cursor: `cursor://testausserveri-ry.testaustime-cursor/authorize?token=${token}`, + }), + ); + const redirectUrl = redirectUrls.get(editor ?? "vscode"); + if (redirectUrl === undefined) { + // Make this prettier + return
{t("authorize.unsupportedEditor")}
; + } + const me = await getMe(); if (!me || "error" in me) { redirect(loginUrl); @@ -49,7 +61,7 @@ export default async function AuthorizePage({ const editorName = editorNames.get(editor ?? "vscode"); if (editorName === undefined) { - return
Invalid editor
; + return
{t("authorize.invalidEditor")}
; } return ( @@ -63,7 +75,7 @@ export default async function AuthorizePage({ {t("authorize.body", { editor: editorName })}