-
{BRANDING.appName}
+
{BRANDING.appName}
+
+ {loading ?
Loading...
: null}
-
- Version
- - {version?.version ?? "unknown"}
+ - Version
+ - {version}
-
- Commit
- - {version?.commit ?? "unknown"}
+ - Commit
+ - {commit}
-
- Build Date
- - {version?.buildDate ?? "unknown"}
+ -
+ Build Date
+
+ - {buildDate}
-
- License
- - {BRANDING.licenseName}
+ - License
+ -
+
+ {licenseName}
+
+
diff --git a/app/licenses/page.tsx b/app/licenses/page.tsx
new file mode 100644
index 00000000..0dfd052a
--- /dev/null
+++ b/app/licenses/page.tsx
@@ -0,0 +1,73 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+import { getAppLicenses } from "@/lib/api";
+import type { AppLicenses } from "@/lib/api-types";
+
+export default function LicensesPage() {
+ const [licenses, setLicenses] = useState
(null);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ getAppLicenses(process.env.NEXT_PUBLIC_API_BASE_URL ?? "")
+ .then(setLicenses)
+ .finally(() => setLoading(false));
+ }, []);
+
+ if (loading) {
+ return (
+
+ );
+ }
+
+ return (
+
+
Licenses
+
+
+ Project License
+ {licenses?.app_license ?? ""}
+
+
+ {licenses?.third_party.length === 0 ? (
+
ライセンス情報を取得できませんでした
+ ) : (
+
+ Third-Party Licenses
+
+
+
+ | Name |
+ Version |
+ License |
+ URL |
+
+
+
+ {licenses?.third_party.map((entry) => (
+
+ | {entry.name} |
+ {entry.version} |
+ {entry.license} |
+
+
+ {entry.url}
+
+ |
+
+ ))}
+
+
+
+ )}
+
+ );
+}
diff --git a/lib/api-types.ts b/lib/api-types.ts
index 4cddd759..47d9241a 100644
--- a/lib/api-types.ts
+++ b/lib/api-types.ts
@@ -185,6 +185,27 @@ export interface ScanJob {
error: string | null;
}
+export interface AppMeta {
+ app_name: string;
+ version: string;
+ git_commit: string;
+ build_date: string;
+ license: string;
+ source_url: string;
+}
+
+export interface LicenseEntry {
+ name: string;
+ version: string;
+ license: string;
+ url: string;
+}
+
+export interface AppLicenses {
+ app_license: string;
+ third_party: LicenseEntry[];
+}
+
export type ActionCompatibilityStatus =
| "supported"
| "partial"
diff --git a/lib/api.ts b/lib/api.ts
index 8ddea256..ec9a3411 100644
--- a/lib/api.ts
+++ b/lib/api.ts
@@ -1,5 +1,7 @@
import type {
AccessTokenMeta,
+ AppLicenses,
+ AppMeta,
CreateTokenResult,
OAuthApp,
OAuthAppCreateInput,
@@ -652,3 +654,17 @@ export function getOrgs(
export function getCurrentUser(token: string): Promise {
return fetchWithToken(token, "/api/v3/user");
}
+
+export async function getAppMeta(baseURL: string): Promise {
+ const response = await fetch(`${baseURL}/api/meta`);
+ return response.json() as Promise;
+}
+
+export async function getAppLicenses(baseURL: string): Promise {
+ try {
+ const response = await fetch(`${baseURL}/api/licenses`);
+ return (await response.json()) as AppLicenses;
+ } catch {
+ return { app_license: "", third_party: [] };
+ }
+}