mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-06 11:36:44 +03:00
Fixes
This commit is contained in:
@@ -15,6 +15,7 @@ services:
|
||||
- DATABASE_URL=file:data/gitea-mirror.db
|
||||
- HOST=0.0.0.0
|
||||
- PORT=4321
|
||||
- BETTER_AUTH_URL=http://localhost:4321
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your-secret-key-change-this-in-production}
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=3", "--spider", "http://localhost:4321/api/health"]
|
||||
|
||||
@@ -68,6 +68,7 @@ export function LoginForm() {
|
||||
domain: domain,
|
||||
providerId: providerId,
|
||||
callbackURL: '/',
|
||||
scopes: ['openid', 'email', 'profile'], // TODO: This is not being respected by the SSO plugin.
|
||||
});
|
||||
} catch (error) {
|
||||
showErrorToast(error, toast);
|
||||
|
||||
@@ -48,10 +48,10 @@ function AppWithProviders({ page: initialPage }: AppProps) {
|
||||
|
||||
useRepoSync({
|
||||
userId: user?.id,
|
||||
enabled: user?.syncEnabled,
|
||||
interval: user?.syncInterval,
|
||||
lastSync: user?.lastSync,
|
||||
nextSync: user?.nextSync,
|
||||
enabled: false, // TODO: Get from config
|
||||
interval: 3600, // TODO: Get from config
|
||||
lastSync: null,
|
||||
nextSync: null,
|
||||
});
|
||||
|
||||
// Handle navigation from sidebar
|
||||
|
||||
@@ -215,7 +215,7 @@ export function OrganizationList({
|
||||
<MirrorDestinationEditor
|
||||
organizationId={org.id!}
|
||||
organizationName={org.name!}
|
||||
currentDestination={org.destinationOrg}
|
||||
currentDestination={org.destinationOrg ?? undefined}
|
||||
onUpdate={(newDestination) => handleUpdateDestination(org.id!, newDestination)}
|
||||
isUpdating={isLoading}
|
||||
/>
|
||||
@@ -260,7 +260,7 @@ export function OrganizationList({
|
||||
<MirrorDestinationEditor
|
||||
organizationId={org.id!}
|
||||
organizationName={org.name!}
|
||||
currentDestination={org.destinationOrg}
|
||||
currentDestination={org.destinationOrg ?? undefined}
|
||||
onUpdate={(newDestination) => handleUpdateDestination(org.id!, newDestination)}
|
||||
isUpdating={isLoading}
|
||||
/>
|
||||
@@ -276,8 +276,9 @@ export function OrganizationList({
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Repository breakdown */}
|
||||
{isLoading || (org.status === "mirroring" && org.publicRepositoryCount === undefined) ? (
|
||||
{/* Repository breakdown - TODO: Add these properties to Organization type */}
|
||||
{/* Commented out until repository count breakdown is available
|
||||
{isLoading || (org.status === "mirroring") ? (
|
||||
<div className="flex items-center gap-3">
|
||||
<Skeleton className="h-4 w-20" />
|
||||
<Skeleton className="h-4 w-20" />
|
||||
@@ -285,32 +286,9 @@ export function OrganizationList({
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center gap-3">
|
||||
{org.publicRepositoryCount !== undefined && (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="h-2.5 w-2.5 rounded-full bg-emerald-500" />
|
||||
<span className="text-muted-foreground">
|
||||
{org.publicRepositoryCount} public
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{org.privateRepositoryCount !== undefined && org.privateRepositoryCount > 0 && (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="h-2.5 w-2.5 rounded-full bg-orange-500" />
|
||||
<span className="text-muted-foreground">
|
||||
{org.privateRepositoryCount} private
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{org.forkRepositoryCount !== undefined && org.forkRepositoryCount > 0 && (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="h-2.5 w-2.5 rounded-full bg-blue-500" />
|
||||
<span className="text-muted-foreground">
|
||||
{org.forkRepositoryCount} {org.forkRepositoryCount === 1 ? "fork" : "forks"}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
*/}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { APIContext } from "astro";
|
||||
import { createSecureErrorResponse } from "@/lib/utils";
|
||||
import { requireAuth } from "@/lib/utils/auth-helpers";
|
||||
import { authClient } from "@/lib/auth-client";
|
||||
import { auth } from "@/lib/auth";
|
||||
|
||||
// POST /api/auth/oauth2/register - Register a new OAuth2 application
|
||||
export async function POST(context: APIContext) {
|
||||
@@ -47,36 +47,38 @@ export async function POST(context: APIContext) {
|
||||
}
|
||||
|
||||
try {
|
||||
// Use Better Auth client to register OAuth2 application
|
||||
const response = await authClient.oauth2.register({
|
||||
client_name,
|
||||
redirect_uris,
|
||||
token_endpoint_auth_method,
|
||||
grant_types,
|
||||
response_types,
|
||||
client_uri,
|
||||
logo_uri,
|
||||
scope,
|
||||
contacts,
|
||||
tos_uri,
|
||||
policy_uri,
|
||||
jwks_uri,
|
||||
jwks,
|
||||
metadata,
|
||||
software_id,
|
||||
software_version,
|
||||
software_statement,
|
||||
// Use Better Auth server API to register OAuth2 application
|
||||
const response = await auth.api.registerOAuthApplication({
|
||||
body: {
|
||||
client_name,
|
||||
redirect_uris,
|
||||
token_endpoint_auth_method,
|
||||
grant_types,
|
||||
response_types,
|
||||
client_uri,
|
||||
logo_uri,
|
||||
scope,
|
||||
contacts,
|
||||
tos_uri,
|
||||
policy_uri,
|
||||
jwks_uri,
|
||||
jwks,
|
||||
metadata,
|
||||
software_id,
|
||||
software_version,
|
||||
software_statement,
|
||||
},
|
||||
});
|
||||
|
||||
// Check if response is an error
|
||||
if ('error' in response && response.error) {
|
||||
if (!response || typeof response !== 'object') {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: response.error.code || "registration_error",
|
||||
error_description: response.error.message || "Failed to register application"
|
||||
error: "registration_error",
|
||||
error_description: "Invalid response from server"
|
||||
}),
|
||||
{
|
||||
status: 400,
|
||||
status: 500,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user