Merge pull request 'fix(ui): use app icon in header' (#3) from fix/use-real-app-icon into main
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -18,7 +18,7 @@ import { runWebhookReconciliation } from "./services/webhookReconcile";
|
||||
|
||||
import { loginHandler, logoutHandler, meHandler, setupStatusHandler, firstUserHandler } from "./routes/auth";
|
||||
import { webhookHandler } from "./routes/webhook";
|
||||
import { getUserSettings, updateUsername, updatePassword, updateGitea, updateAws, getWebhookSecret, regenerateWebhookSecret } from "./routes/api/user";
|
||||
import { getUserSettings, updateUsername, updatePassword, updateGitea, updateAws, skipSetupWizard, getWebhookSecret, regenerateWebhookSecret } from "./routes/api/user";
|
||||
import { listRepos, saveRepoConfig, toggleRepoEnabled, getRepoConfig } from "./routes/api/repos";
|
||||
import { listPreviews, getPreview, stopPreviewRoute, rebuildPreviewRoute, previewLogsWs, previewAppLogsWs } from "./routes/api/previews";
|
||||
import { getStats } from "./routes/api/stats";
|
||||
@@ -66,6 +66,7 @@ server.path("/", (path) => path
|
||||
.http("PATCH", "/api/user/password", (http) => http.onRequest(updatePassword))
|
||||
.http("PUT", "/api/user/gitea", (http) => http.onRequest(updateGitea))
|
||||
.http("PUT", "/api/user/aws", (http) => http.onRequest(updateAws))
|
||||
.http("POST", "/api/user/setup/skip", (http) => http.onRequest(skipSetupWizard))
|
||||
.http("GET", "/api/user/webhook-secret", (http) => http.onRequest(getWebhookSecret))
|
||||
.http("POST", "/api/user/webhook-secret/regenerate", (http) => http.onRequest(regenerateWebhookSecret))
|
||||
);
|
||||
|
||||
@@ -181,6 +181,18 @@ export async function updateAws(ctr: any) {
|
||||
return makeResponse({ ctr, content: { code: 200, message: `Connected as ${validation.arn}`, data: { arn: validation.arn } } });
|
||||
}
|
||||
|
||||
export async function skipSetupWizard(ctr: any) {
|
||||
const user = requireAuth(ctr);
|
||||
if (!user) return makeResponse({ ctr, content: { code: 401, message: ERROR_MESSAGES.UNAUTHORIZED.message } });
|
||||
|
||||
await prisma.user.update({
|
||||
where: { id: user.id },
|
||||
data: { setupSkipped: true },
|
||||
});
|
||||
|
||||
return makeResponse({ ctr, content: { code: 200, message: "Setup wizard skipped" } });
|
||||
}
|
||||
|
||||
export async function getWebhookSecret(ctr: any) {
|
||||
const user = requireAuth(ctr);
|
||||
if (!user) return makeResponse({ ctr, content: { code: 401, message: ERROR_MESSAGES.UNAUTHORIZED.message } });
|
||||
|
||||
@@ -10,6 +10,17 @@ const log = createLogger("AUTH_ROUTE");
|
||||
const COOKIE_NAME = "pp_session";
|
||||
const COOKIE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
function isSetupComplete(user: {
|
||||
setupSkipped: boolean;
|
||||
giteaInstanceUrl: string | null;
|
||||
giteaPAT: string | null;
|
||||
awsAccessKeyId: string | null;
|
||||
awsSecretAccessKey: string | null;
|
||||
awsRegion: string | null;
|
||||
}) {
|
||||
return user.setupSkipped || !!(user.giteaInstanceUrl && user.giteaPAT && user.awsAccessKeyId && user.awsSecretAccessKey && user.awsRegion);
|
||||
}
|
||||
|
||||
export async function loginHandler(ctr: any) {
|
||||
let body: any;
|
||||
try {
|
||||
@@ -82,7 +93,8 @@ export async function meHandler(ctr: any) {
|
||||
awsAccessKeyId: user.awsAccessKeyId ? "****" : null,
|
||||
awsRegion: user.awsRegion,
|
||||
awsConfigured: !!(user.awsAccessKeyId && user.awsSecretAccessKey && user.awsRegion),
|
||||
setupComplete: !!(user.giteaInstanceUrl && user.giteaPAT && user.awsAccessKeyId && user.awsSecretAccessKey && user.awsRegion),
|
||||
setupSkipped: user.setupSkipped,
|
||||
setupComplete: isSetupComplete(user),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user