refactor: replace custom geo manager with Xray-core native geodata auto-update

Remove the panel-side custom geo download feature (service, controller,
/panel/api/custom-geo/* endpoints, CustomGeoResource model, UI tab) in
favor of Xray-core's native geodata section
(https://xtls.github.io/config/geodata.html).

- pass the top-level "geodata" key through xray.Config so it survives
  the template round-trip into the generated config
- add a Geodata Auto-Update section to the Xray Updates modal that
  edits geodata (cron schedule, download outbound, asset list) in the
  config template and restarts Xray on save
- previously downloaded geo files in the bin folder keep working in
  ext: routing rules; the orphaned custom_geo_resources table is left
  in place so existing source URLs stay recoverable
This commit is contained in:
MHSanaei
2026-06-10 18:27:12 +02:00
parent 4002be4ade
commit 3092326d9e
43 changed files with 416 additions and 2875 deletions
-21
View File
@@ -72,26 +72,6 @@ export const OutboundTestResultSchema = z.object({
.optional(),
}).loose();
export const CustomGeoFormSchema = z.object({
type: z.enum(['geosite', 'geoip']),
alias: z.string().regex(/^[a-z0-9_-]+$/, 'pages.index.customGeoValidationAlias'),
url: z
.string()
.trim()
.refine(
(u) => {
if (!/^https?:\/\//i.test(u)) return false;
try {
const parsed = new URL(u);
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
} catch {
return false;
}
},
{ message: 'pages.index.customGeoValidationUrl' },
),
});
export const RuleFormSchema = z.object({
domain: z.string(),
ip: z.string(),
@@ -123,7 +103,6 @@ export const OutboundTagSchema = z
export type BalancerFormValues = z.infer<typeof BalancerFormSchema>;
export type RuleFormValues = z.infer<typeof RuleFormSchema>;
export type CustomGeoFormValues = z.infer<typeof CustomGeoFormSchema>;
export type XraySettingsValue = z.infer<typeof XraySettingsValueSchema>;
export type XrayConfigPayload = z.infer<typeof XrayConfigPayloadSchema>;
export type OutboundTrafficRow = z.infer<typeof OutboundTrafficRowSchema>;