Prepare ForgeFlow for public release
This commit is contained in:
1 parent
57929ea973
commit
8cca1bfc01
29 files changed
+400
-343
No files matched your search
+18
-2
@@ -20,6 +20,7 @@ const {
|
||||
readEncryptedBackup,
|
||||
} = require("./configuration-backup.cjs");
|
||||
const { evaluateDeploymentPolicy } = require("../shared/deployment-policy.cjs");
|
||||
const { normalizeBaseUrl } = require("../shared/validation.cjs");
|
||||
function registerIpc({
|
||||
store,
|
||||
git,
|
||||
@@ -253,8 +254,23 @@ function registerIpc({
|
||||
});
|
||||
|
||||
register("settings:update-gitea", async ({ baseUrl, token }) => {
|
||||
const effectiveToken = String(token || "").trim() || store.getToken();
|
||||
const validation = await gitea.validateConnection(baseUrl, effectiveToken);
|
||||
const normalizedBaseUrl = normalizeBaseUrl(baseUrl);
|
||||
const currentBaseUrl = store.data.gitea.baseUrl
|
||||
? normalizeBaseUrl(store.data.gitea.baseUrl)
|
||||
: "";
|
||||
const submittedToken = String(token || "").trim();
|
||||
if (!submittedToken && normalizedBaseUrl !== currentBaseUrl) {
|
||||
const error = new Error(
|
||||
"Enter a new Gitea token when changing the server address. Stored tokens are bound to their original origin.",
|
||||
);
|
||||
error.code = "GITEA_TOKEN_ORIGIN_CHANGED";
|
||||
throw error;
|
||||
}
|
||||
const effectiveToken = submittedToken || store.getToken();
|
||||
const validation = await gitea.validateConnection(
|
||||
normalizedBaseUrl,
|
||||
effectiveToken,
|
||||
);
|
||||
const tokenState = await store.updateGitea({
|
||||
baseUrl: validation.baseUrl,
|
||||
token,
|
||||
|
||||
Reference in new issue
Block a user