mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-11 22:16:44 +03:00
Added a few new features.
This commit is contained in:
@@ -35,8 +35,8 @@ else
|
|||||||
echo "No custom CA certificates found in /app/certs"
|
echo "No custom CA certificates found in /app/certs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if system CA bundle is mounted and use it
|
# Check if system CA bundle is mounted and use it (only if not already set)
|
||||||
if [ -f "/etc/ssl/certs/ca-certificates.crt" ] && [ ! -L "/etc/ssl/certs/ca-certificates.crt" ]; then
|
if [ -z "$NODE_EXTRA_CA_CERTS" ] && [ -f "/etc/ssl/certs/ca-certificates.crt" ] && [ ! -L "/etc/ssl/certs/ca-certificates.crt" ]; then
|
||||||
# Check if it's a mounted file (not the default symlink)
|
# Check if it's a mounted file (not the default symlink)
|
||||||
if [ "$(stat -c '%d' /etc/ssl/certs/ca-certificates.crt 2>/dev/null)" != "$(stat -c '%d' / 2>/dev/null)" ] || \
|
if [ "$(stat -c '%d' /etc/ssl/certs/ca-certificates.crt 2>/dev/null)" != "$(stat -c '%d' / 2>/dev/null)" ] || \
|
||||||
[ "$(stat -f '%d' /etc/ssl/certs/ca-certificates.crt 2>/dev/null)" != "$(stat -f '%d' / 2>/dev/null)" ]; then
|
[ "$(stat -f '%d' /etc/ssl/certs/ca-certificates.crt 2>/dev/null)" != "$(stat -f '%d' / 2>/dev/null)" ]; then
|
||||||
|
|||||||
@@ -17,16 +17,35 @@ export const auth = betterAuth({
|
|||||||
// Secret for signing tokens
|
// Secret for signing tokens
|
||||||
secret: process.env.BETTER_AUTH_SECRET,
|
secret: process.env.BETTER_AUTH_SECRET,
|
||||||
|
|
||||||
// Base URL configuration
|
// Base URL configuration - ensure it's a valid URL
|
||||||
baseURL: process.env.BETTER_AUTH_URL || "http://localhost:4321",
|
baseURL: (() => {
|
||||||
|
const url = process.env.BETTER_AUTH_URL || "http://localhost:4321";
|
||||||
|
try {
|
||||||
|
// Validate URL format
|
||||||
|
new URL(url);
|
||||||
|
return url;
|
||||||
|
} catch {
|
||||||
|
console.warn(`Invalid BETTER_AUTH_URL: ${url}, falling back to localhost`);
|
||||||
|
return "http://localhost:4321";
|
||||||
|
}
|
||||||
|
})(),
|
||||||
basePath: "/api/auth", // Specify the base path for auth endpoints
|
basePath: "/api/auth", // Specify the base path for auth endpoints
|
||||||
|
|
||||||
// Trusted origins for OAuth flows
|
// Trusted origins for OAuth flows - parse from environment if set
|
||||||
trustedOrigins: [
|
trustedOrigins: (() => {
|
||||||
|
const origins = [
|
||||||
"http://localhost:4321",
|
"http://localhost:4321",
|
||||||
"http://localhost:8080", // Keycloak
|
"http://localhost:8080", // Keycloak
|
||||||
process.env.BETTER_AUTH_URL || "http://localhost:4321"
|
process.env.BETTER_AUTH_URL || "http://localhost:4321"
|
||||||
].filter(Boolean),
|
];
|
||||||
|
|
||||||
|
// Add trusted origins from environment if set
|
||||||
|
if (process.env.BETTER_AUTH_TRUSTED_ORIGINS) {
|
||||||
|
origins.push(...process.env.BETTER_AUTH_TRUSTED_ORIGINS.split(',').map(o => o.trim()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return origins.filter(Boolean);
|
||||||
|
})(),
|
||||||
|
|
||||||
// Authentication methods
|
// Authentication methods
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ export const repositorySchema = z.object({
|
|||||||
"mirrored",
|
"mirrored",
|
||||||
"failed",
|
"failed",
|
||||||
"skipped",
|
"skipped",
|
||||||
|
"ignored", // User explicitly wants to ignore this repository
|
||||||
"deleting",
|
"deleting",
|
||||||
"deleted",
|
"deleted",
|
||||||
"syncing",
|
"syncing",
|
||||||
@@ -166,6 +167,7 @@ export const mirrorJobSchema = z.object({
|
|||||||
"mirrored",
|
"mirrored",
|
||||||
"failed",
|
"failed",
|
||||||
"skipped",
|
"skipped",
|
||||||
|
"ignored", // User explicitly wants to ignore this repository
|
||||||
"deleting",
|
"deleting",
|
||||||
"deleted",
|
"deleted",
|
||||||
"syncing",
|
"syncing",
|
||||||
@@ -202,6 +204,7 @@ export const organizationSchema = z.object({
|
|||||||
"mirrored",
|
"mirrored",
|
||||||
"failed",
|
"failed",
|
||||||
"skipped",
|
"skipped",
|
||||||
|
"ignored", // User explicitly wants to ignore this repository
|
||||||
"deleting",
|
"deleting",
|
||||||
"deleted",
|
"deleted",
|
||||||
"syncing",
|
"syncing",
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ export const repoStatusEnum = z.enum([
|
|||||||
"mirroring",
|
"mirroring",
|
||||||
"mirrored",
|
"mirrored",
|
||||||
"failed",
|
"failed",
|
||||||
|
"skipped",
|
||||||
|
"ignored", // User explicitly wants to ignore this repository
|
||||||
|
"deleting",
|
||||||
|
"deleted",
|
||||||
"syncing",
|
"syncing",
|
||||||
"synced",
|
"synced",
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user