Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(mobile): return to the app after device approval

Tin8f107a48c765
diff --git a/apps/mobile/app.json b/apps/mobile/app.json
index 029d305b2..a29f26aae 100644
--- a/apps/mobile/app.json
+++ b/apps/mobile/app.json
@@ -2,7 +2,7 @@
"expo": {
"name": "Kaneo",
"slug": "kaneo",
- "version": "1.0.0",
+ "version": "0.2.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "kaneo",
@@ -23,6 +23,7 @@
},
"android": {
"package": "de.usekaneo.kaneo",
+ "versionCode": 2,
"adaptiveIcon": {
"backgroundColor": "#141414",
"foregroundImage": "./assets/images/android-icon-foreground.png",
diff --git a/apps/web/src/routes/device/approve.tsx b/apps/web/src/routes/device/approve.tsx
index 6b1f21d2e..907333471 100644
--- a/apps/web/src/routes/device/approve.tsx
+++ b/apps/web/src/routes/device/approve.tsx
@@ -21,8 +21,11 @@ import { toast } from "@/lib/toast";
const approveSearchSchema = z.object({
user_code: z.string().optional(),
+ from: z.literal("app").optional().catch(undefined),
});
+const APP_RETURN_URL = "kaneo://";
+
export const Route = createFileRoute("/device/approve")({
component: DeviceApprovePage,
validateSearch: approveSearchSchema,
@@ -38,6 +41,7 @@ function DeviceApprovePage() {
const [pending, setPending] = useState<Decision | null>(null);
const [result, setResult] = useState<Decision | null>(null);
const userCode = normalizeDeviceCode(search.user_code);
+ const fromApp = search.from === "app";
const pageTitle = <PageTitle title={t("auth:device.approve.pageTitle")} />;
if (result) {
@@ -57,7 +61,17 @@ function DeviceApprovePage() {
: t("auth:device.denied.description")}
</span>
}
- />
+ >
+ {fromApp && (
+ <Button
+ size="lg"
+ className="w-full"
+ render={<a href={APP_RETURN_URL} />}
+ >
+ {t("auth:device.openApp")}
+ </Button>
+ )}
+ </AuthPage>
</>
);
}
@@ -104,7 +118,7 @@ function DeviceApprovePage() {
void navigate({
to: "/auth/sign-in",
search: {
- redirect: `/device/approve?user_code=${encodeURIComponent(userCode)}`,
+ redirect: `/device/approve?user_code=${encodeURIComponent(userCode)}${fromApp ? "&from=app" : ""}`,
},
})
}
@@ -135,6 +149,8 @@ function DeviceApprovePage() {
return;
}
setResult(decision);
+ // Reopening the app closes the in-app browser tab it signed in from.
+ if (fromApp) window.location.assign(APP_RETURN_URL);
} catch {
toast.error(t("auth:device.approve.failed"));
setPending(null);
diff --git a/apps/web/src/routes/device/index.tsx b/apps/web/src/routes/device/index.tsx
index ad217cca1..7e5cf7d61 100644
--- a/apps/web/src/routes/device/index.tsx
+++ b/apps/web/src/routes/device/index.tsx
@@ -19,6 +19,8 @@ const MIN_CODE_LENGTH = 4;
const deviceSearchSchema = z.object({
user_code: z.string().optional(),
+ // Set by the mobile app so approval can hand control back to it.
+ from: z.literal("app").optional().catch(undefined),
});
export const Route = createFileRoute("/device/")({
@@ -52,7 +54,10 @@ function DevicePage() {
setIsPending(false);
return;
}
- void navigate({ to: "/device/approve", search: { user_code: userCode } });
+ void navigate({
+ to: "/device/approve",
+ search: { user_code: userCode, from: search.from },
+ });
} catch {
setError(t("auth:device.connect.invalidCode"));
setIsPending(false);
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index d60fde309..3a1a51c85 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -535,7 +535,8 @@
"title": "Cihazınızı qoşmaq üçün daxil olun",
"description": "Təsdiqləmək üçün dərhal bura qayıdacaqsınız.",
"submit": "Daxil ol"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index ff4ac32ac..2228888dc 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -535,7 +535,8 @@
"title": "Melde dich an, um dein Gerät zu verbinden",
"description": "Danach kommst du direkt hierher zurück, um es zu genehmigen.",
"submit": "Anmelden"
- }
+ },
+ "openApp": "Kaneo öffnen"
},
"mcp": {
"authorize": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index 4d21e668d..b644b0aba 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -535,7 +535,8 @@
"title": "Συνδεθείτε για να συνδέσετε τη συσκευή σας",
"description": "Θα επιστρέψετε αμέσως εδώ για να την εγκρίνετε.",
"submit": "Σύνδεση"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/en-US.json b/i18n/en-US.json
index e7c6b5683..00accc51a 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -526,6 +526,7 @@
"title": "Request denied",
"description": "Nothing was connected. You can close this tab."
},
+ "openApp": "Open Kaneo",
"missing": {
"title": "No device code",
"description": "Open this page from your device, or enter the code yourself.",
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index 64153cee5..8204d396a 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -540,7 +540,8 @@
"title": "Inicia sesión para conectar tu dispositivo",
"description": "Volverás aquí enseguida para aprobarlo.",
"submit": "Iniciar sesión"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index 9931dca78..22c9d6868 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -540,7 +540,8 @@
"title": "Connectez-vous pour associer votre appareil",
"description": "Vous reviendrez ici juste après pour l'approuver.",
"submit": "Se connecter"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index b1a333a0a..6348650a9 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -535,7 +535,8 @@
"title": "अपना डिवाइस कनेक्ट करने के लिए साइन इन करें",
"description": "इसे स्वीकृत करने के लिए आप तुरंत यहीं वापस आएँगे।",
"submit": "साइन इन करें"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index d270462ce..8fe8cd8a5 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -530,7 +530,8 @@
"title": "Masuk untuk menghubungkan perangkat Anda",
"description": "Anda akan langsung kembali ke sini untuk menyetujuinya.",
"submit": "Masuk"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index 22ea15e9e..f8617bcb2 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -540,7 +540,8 @@
"title": "Accedi per collegare il tuo dispositivo",
"description": "Tornerai subito qui per approvarlo.",
"submit": "Accedi"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index b4c3a0b23..878813050 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -530,7 +530,8 @@
"title": "サインインしてデバイスを接続",
"description": "サインイン後すぐにこのページに戻り、承認できます。",
"submit": "サインイン"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index a9d267ebf..5b092cf56 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -530,7 +530,8 @@
"title": "로그인하여 기기 연결",
"description": "로그인 후 바로 이곳으로 돌아와 승인할 수 있습니다.",
"submit": "로그인"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index 0b43416ff..86d80e54a 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -535,7 +535,8 @@
"title": "Најави се за да го поврзеш уредот",
"description": "Веднаш потоа ќе се вратиш тука за да го одобриш.",
"submit": "Најави се"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index cb6ba0006..318cea44c 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -535,7 +535,8 @@
"title": "Log in om je apparaat te koppelen",
"description": "Daarna kom je meteen hier terug om het goed te keuren.",
"submit": "Inloggen"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index d268e8a81..54893c979 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -545,7 +545,8 @@
"title": "Zaloguj się, aby połączyć urządzenie",
"description": "Zaraz potem wrócisz tutaj, aby je zatwierdzić.",
"submit": "Zaloguj się"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index ee7377f92..84eddd227 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -540,7 +540,8 @@
"title": "Entre para conectar seu dispositivo",
"description": "Você voltará para cá logo em seguida para aprová-lo.",
"submit": "Entrar"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 35295effd..bb2f5d972 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -545,7 +545,8 @@
"title": "Войдите, чтобы подключить устройство",
"description": "Сразу после входа вы вернётесь сюда, чтобы подтвердить его.",
"submit": "Войти"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/schema.json b/i18n/schema.json
index d48a7f896..ae524e80d 100644
--- a/i18n/schema.json
+++ b/i18n/schema.json
@@ -2093,6 +2093,9 @@
},
"required": ["title", "description"]
},
+ "openApp": {
+ "type": "string"
+ },
"missing": {
"type": "object",
"additionalProperties": false,
@@ -2131,6 +2134,7 @@
"approve",
"approved",
"denied",
+ "openApp",
"missing",
"signIn"
]
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index b48599b2b..ffe968405 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -535,7 +535,8 @@
"title": "Cihazınızı bağlamak için giriş yapın",
"description": "Onaylamak için hemen buraya geri döneceksiniz.",
"submit": "Giriş yap"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index 06c19ae37..6c9cb82e6 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -545,7 +545,8 @@
"title": "Увійдіть, щоб підключити пристрій",
"description": "Одразу після входу ви повернетеся сюди, щоб підтвердити його.",
"submit": "Увійти"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index e79e28d27..7c6abce15 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -530,7 +530,8 @@
"title": "Đăng nhập để kết nối thiết bị",
"description": "Bạn sẽ quay lại đây ngay để phê duyệt.",
"submit": "Đăng nhập"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index f0bef457d..8a6c0813f 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -530,7 +530,8 @@
"title": "登录以连接你的设备",
"description": "登录后会立即返回此处进行批准。",
"submit": "登录"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {
diff --git a/i18n/zh-TW.json b/i18n/zh-TW.json
index 37db4dcf8..9471b89c6 100644
--- a/i18n/zh-TW.json
+++ b/i18n/zh-TW.json
@@ -530,7 +530,8 @@
"title": "登入以連結你的裝置",
"description": "登入後會立即回到這裡進行核准。",
"submit": "登入"
- }
+ },
+ "openApp": "Open Kaneo"
},
"mcp": {
"authorize": {