mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-08-07 17:33:10 +02:00
The fix in v3.15.8 made scheduleConfig.autoMirror an independent trigger in the scheduler, but it remained reachable only via the AUTO_MIRROR_REPOS env var. This adds a UI checkbox under the Automatic Syncing section so the option can be toggled per-config without touching the environment. The toggle is conditional on scheduling being enabled (since auto-mirror without a scheduler is meaningless) and is independent of the existing "Auto-mirror new starred repositories" toggle in GitHub settings. Together they cover the full owned/starred matrix that the scheduler already supports. Plumbing: config-mapper.ts now round-trips autoMirror through the UI/DB boundary, and ScheduleConfig in types/config.ts gets the matching field. No schema or migration change — autoMirror was already in the zod schema.
This commit is contained in:
@@ -269,6 +269,31 @@ export function AutomationSettings({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-start space-x-3 pt-1">
|
||||
<Checkbox
|
||||
id="enable-auto-mirror-new"
|
||||
checked={scheduleConfig.autoMirror ?? false}
|
||||
className="mt-1.25"
|
||||
onCheckedChange={(checked) =>
|
||||
onScheduleChange({
|
||||
...scheduleConfig,
|
||||
autoMirror: !!checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<div className="space-y-0.5 flex-1">
|
||||
<Label
|
||||
htmlFor="enable-auto-mirror-new"
|
||||
className="text-sm font-normal cursor-pointer"
|
||||
>
|
||||
Auto-mirror new repositories
|
||||
</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Automatically mirror newly imported repositories on each scheduled sync. When off, new repos are imported for browsing but require a manual mirror click. (Starred repos have their own toggle in GitHub settings.)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -246,6 +246,7 @@ export function mapUiScheduleToDb(uiSchedule: any, existing?: DbScheduleConfig):
|
||||
enabled: !!uiSchedule.enabled,
|
||||
interval: intervalExpression,
|
||||
timezone,
|
||||
autoMirror: typeof uiSchedule.autoMirror === "boolean" ? uiSchedule.autoMirror : base.autoMirror,
|
||||
nextRun: scheduleChanged ? undefined : base.nextRun,
|
||||
} as DbScheduleConfig;
|
||||
}
|
||||
@@ -264,6 +265,7 @@ export function mapDbScheduleToUi(dbSchedule: DbScheduleConfig): any {
|
||||
clockFrequencyHours: 24,
|
||||
startTime: "22:00",
|
||||
timezone: "UTC",
|
||||
autoMirror: false,
|
||||
lastRun: null,
|
||||
nextRun: null,
|
||||
};
|
||||
@@ -296,6 +298,7 @@ export function mapDbScheduleToUi(dbSchedule: DbScheduleConfig): any {
|
||||
clockFrequencyHours: parsedClockSchedule?.frequencyHours ?? 24,
|
||||
startTime: parsedClockSchedule?.startTime ?? "22:00",
|
||||
timezone: normalizeTimezone(dbSchedule.timezone || "UTC"),
|
||||
autoMirror: dbSchedule.autoMirror ?? false,
|
||||
lastRun: dbSchedule.lastRun || null,
|
||||
nextRun: dbSchedule.nextRun || null,
|
||||
};
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface ScheduleConfig {
|
||||
clockFrequencyHours?: number;
|
||||
startTime?: string;
|
||||
timezone?: string;
|
||||
autoMirror?: boolean;
|
||||
lastRun?: Date;
|
||||
nextRun?: Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user