Add custom geosite/geoip URL sources (#3980)
* feat: add custom geosite/geoip URL sources Register DB model, panel API, index/xray UI, and i18n. * fix
This commit is contained in:
committed by
GitHub
parent
96b568b838
commit
7466916e02
@@ -259,6 +259,7 @@
|
||||
refreshing: false,
|
||||
restartResult: '',
|
||||
showAlert: false,
|
||||
customGeoAliasLabelSuffix: '{{ i18n "pages.index.customGeoAliasLabelSuffix" }}',
|
||||
advSettings: 'xraySetting',
|
||||
obsSettings: '',
|
||||
cm: null,
|
||||
@@ -1054,6 +1055,31 @@
|
||||
},
|
||||
showWarp() {
|
||||
warpModal.show();
|
||||
},
|
||||
async loadCustomGeoAliases() {
|
||||
try {
|
||||
const msg = await HttpUtil.get('/panel/api/custom-geo/aliases');
|
||||
if (!msg.success) {
|
||||
console.warn('Failed to load custom geo aliases:', msg.msg || 'request failed');
|
||||
return;
|
||||
}
|
||||
if (!msg.obj) return;
|
||||
const { geoip = [], geosite = [] } = msg.obj;
|
||||
const geoSuffix = this.customGeoAliasLabelSuffix || '';
|
||||
geoip.forEach((x) => {
|
||||
this.settingsData.IPsOptions.push({
|
||||
label: x.alias + geoSuffix,
|
||||
value: x.extExample,
|
||||
});
|
||||
});
|
||||
geosite.forEach((x) => {
|
||||
const opt = { label: x.alias + geoSuffix, value: x.extExample };
|
||||
this.settingsData.DomainsOptions.push(opt);
|
||||
this.settingsData.BlockDomainsOptions.push(opt);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Failed to load custom geo aliases:', e);
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@@ -1061,6 +1087,7 @@
|
||||
this.showAlert = true;
|
||||
}
|
||||
await this.getXraySetting();
|
||||
await this.loadCustomGeoAliases();
|
||||
await this.getXrayResult();
|
||||
await this.getOutboundsTraffic();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user