mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-23 02:52:58 +02:00
Update language and add debug
This commit is contained in:
+9
-8
@@ -576,10 +576,10 @@
|
|||||||
"licenseQuestionRemove": "Are you sure you want to delete the license key ?",
|
"licenseQuestionRemove": "Are you sure you want to delete the license key ?",
|
||||||
"licenseKeyDelete": "Delete License Key",
|
"licenseKeyDelete": "Delete License Key",
|
||||||
"licenseKeyDeleteConfirm": "Confirm Delete License Key",
|
"licenseKeyDeleteConfirm": "Confirm Delete License Key",
|
||||||
"licenseTitle": "Manage License Status",
|
"licenseTitle": "Manage Licenses",
|
||||||
"licenseTitleDescription": "View and manage license keys in the system",
|
"licenseTitleDescription": "View and manage license keys in the system",
|
||||||
"licenseHost": "Host License",
|
"licenseHost": "License",
|
||||||
"licenseHostDescription": "Manage the main license key for the host.",
|
"licenseHostDescription": "See the license tier and host information",
|
||||||
"licensedNot": "Not Licensed",
|
"licensedNot": "Not Licensed",
|
||||||
"hostId": "Host ID",
|
"hostId": "Host ID",
|
||||||
"licenseReckeckAll": "Recheck All Keys",
|
"licenseReckeckAll": "Recheck All Keys",
|
||||||
@@ -589,15 +589,16 @@
|
|||||||
"licensePurchase": "Purchase License",
|
"licensePurchase": "Purchase License",
|
||||||
"licensePurchaseSites": "Purchase Additional Sites",
|
"licensePurchaseSites": "Purchase Additional Sites",
|
||||||
"licenseSitesUsedMax": "{usedSites} of {maxSites} sites used",
|
"licenseSitesUsedMax": "{usedSites} of {maxSites} sites used",
|
||||||
"licenseSitesUsed": "{count, plural, =0 {# sites} one {# site} other {# sites}} in system.",
|
"licenseSitesUsed": "{count, plural, =0 {# sites} one {# site} other {# sites}}",
|
||||||
"licenseUsage": "License Usage",
|
"licenseUsage": "Usage",
|
||||||
"licenseUsageDescription": "View the number of users and sites licensed for this host.",
|
"licenseUsageDescription": "View the number of users and sites licensed for this host",
|
||||||
"licenseUsageSites": "Sites",
|
"licenseUsageSites": "Sites",
|
||||||
"licenseUsageUsers": "Users",
|
"licenseUsageUsers": "Users",
|
||||||
"licenseNoUserLimit": "There is no limit on the number of users using an unlicensed host.",
|
"licenseNoUserLimit": "There is no limit on the number of users using an unlicensed hot",
|
||||||
"licenseUsersUsedMax": "{usedUsers} of {maxUsers} users used",
|
"licenseUsersUsedMax": "{usedUsers} of {maxUsers} users used",
|
||||||
"licenseUsersUsed": "{count, plural, =0 {# users} one {# user} other {# users}} in system.",
|
"licenseUsersUsed": "{count, plural, =0 {# users} one {# user} other {# users}}",
|
||||||
"licenseUnlimited": "Unlimited",
|
"licenseUnlimited": "Unlimited",
|
||||||
|
"licenseTierLabel": "Tier",
|
||||||
"licensePurchaseDescription": "Choose how many sites you want to {selectedMode, select, license {purchase a license for. You can always add more sites later.} other {add to your existing license.}}",
|
"licensePurchaseDescription": "Choose how many sites you want to {selectedMode, select, license {purchase a license for. You can always add more sites later.} other {add to your existing license.}}",
|
||||||
"licenseFee": "License fee",
|
"licenseFee": "License fee",
|
||||||
"licensePriceSite": "Price per site",
|
"licensePriceSite": "Price per site",
|
||||||
|
|||||||
@@ -297,6 +297,11 @@ LQIDAQAB
|
|||||||
if (!apiResponse?.success) {
|
if (!apiResponse?.success) {
|
||||||
throw new Error(apiResponse?.error);
|
throw new Error(apiResponse?.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
`License server response: ${JSON.stringify(apiResponse)}`
|
||||||
|
);
|
||||||
|
|
||||||
// Reset failure count on success
|
// Reset failure count on success
|
||||||
this.phoneHomeFailureCount = 0;
|
this.phoneHomeFailureCount = 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -359,6 +364,11 @@ LQIDAQAB
|
|||||||
licenseKeyRes,
|
licenseKeyRes,
|
||||||
this.publicKey
|
this.publicKey
|
||||||
);
|
);
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
`Decoded license key ${key.licenseKey}: ${JSON.stringify(payload)}`
|
||||||
|
);
|
||||||
|
|
||||||
cached.valid = payload.valid;
|
cached.valid = payload.valid;
|
||||||
cached.type = payload.type;
|
cached.type = payload.type;
|
||||||
cached.tier = payload.tier;
|
cached.tier = payload.tier;
|
||||||
@@ -451,6 +461,8 @@ LQIDAQAB
|
|||||||
this.checkInProgress = false;
|
this.checkInProgress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug(`Computed license status: ${JSON.stringify(status)}`);
|
||||||
|
|
||||||
this.statusCache.set(this.statusKey, status, 0);
|
this.statusCache.set(this.statusKey, status, 0);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { LicenseKeyCache } from "@server/license/license";
|
import { LicenseKeyCache, LicenseKeyTier } from "@server/license/license";
|
||||||
import { createApiClient } from "@app/lib/api";
|
import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { toast } from "@app/hooks/useToast";
|
import { toast } from "@app/hooks/useToast";
|
||||||
@@ -65,6 +65,23 @@ const ENTERPRISE_DOCS_URL =
|
|||||||
"https://docs.pangolin.net/self-host/enterprise-edition";
|
"https://docs.pangolin.net/self-host/enterprise-edition";
|
||||||
const ENTERPRISE_PRICING_URL = "https://pangolin.net/pricing#Self-Hosted";
|
const ENTERPRISE_PRICING_URL = "https://pangolin.net/pricing#Self-Hosted";
|
||||||
|
|
||||||
|
function getTierLabel(
|
||||||
|
tier: LicenseKeyTier | undefined,
|
||||||
|
t: (key: string) => string
|
||||||
|
): string {
|
||||||
|
switch (tier) {
|
||||||
|
case "enterprise":
|
||||||
|
return t("licenseTierEnterprise");
|
||||||
|
case "tier1":
|
||||||
|
return t("licenseTierTier1");
|
||||||
|
case "tier2":
|
||||||
|
return t("licenseTierTier2");
|
||||||
|
case "personal":
|
||||||
|
default:
|
||||||
|
return t("licenseTierPersonal");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function LicensePage() {
|
export default function LicensePage() {
|
||||||
const api = createApiClient(useEnvContext());
|
const api = createApiClient(useEnvContext());
|
||||||
const [rows, setRows] = useState<LicenseKeyCache[]>([]);
|
const [rows, setRows] = useState<LicenseKeyCache[]>([]);
|
||||||
@@ -514,6 +531,14 @@ export default function LicensePage() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="text-sm font-medium">
|
||||||
|
{t("licenseTierLabel")}
|
||||||
|
</div>
|
||||||
|
<div className="text-lg">
|
||||||
|
{getTierLabel(licenseStatus?.tier, t)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{licenseStatus?.hostId && (
|
{licenseStatus?.hostId && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="text-sm font-medium">
|
<div className="text-sm font-medium">
|
||||||
|
|||||||
Reference in New Issue
Block a user