mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
fix: finish 2.9.0 plugin moves and get every check green
This commit is contained in:
1 parent
8c1e02af89
commit
6489b62ece
335 files changed
+29878
-17749
No files matched your search
@@ -396,3 +396,22 @@ export function parseSshCertificate(line: string): SshCertificateInfo {
|
||||
validBefore: toDate(validBefore),
|
||||
};
|
||||
}
|
||||
|
||||
/** Save-time checks for the admin page: a bad URL or fingerprint says so there. */
|
||||
export function validateCaSettings(
|
||||
values: Record<string, unknown>,
|
||||
): Record<string, string> {
|
||||
const errors: Record<string, string> = {};
|
||||
const check = (key: string, normalize: (raw: string) => string) => {
|
||||
const value = values[key];
|
||||
if (typeof value !== "string" || value.trim() === "") return;
|
||||
try {
|
||||
normalize(value);
|
||||
} catch (error) {
|
||||
errors[key] = error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
};
|
||||
check("caUrl", normalizeCaUrl);
|
||||
check("fingerprint", normalizeFingerprint);
|
||||
return errors;
|
||||
}
|
||||
@@ -6,8 +6,10 @@ import { createRuntime } from "./runtime.js";
|
||||
import { createAuthSessions } from "./auth-session.js";
|
||||
import { createStepCaProvider } from "./provider.js";
|
||||
import { PUBLIC_PATHS, registerRoutes } from "./routes.js";
|
||||
import { validateCaSettings } from "./client.js";
|
||||
|
||||
export async function activate(ctx: PluginContext) {
|
||||
ctx.settings.onValidate("admin", validateCaSettings);
|
||||
const table = await ctx.db.define(certsTable);
|
||||
const certs = createCertStore(ctx, table);
|
||||
|
||||
|
||||
Reference in new issue
Block a user