mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 17:43:56 +08:00
This commit is contained in:
1 parent
c7bafc635d
commit
c71da84035
264 files changed
+8169
-3944
No files matched your search
@@ -144,10 +144,10 @@ const callSmartFlushCache = rpc.declare({ object: 'luci.clashoo', method:
|
||||
const callListSingboxProfiles = rpc.declare({ object: 'luci.clashoo', method: 'list_singbox_profiles', expect: {} });
|
||||
const callGetSingboxProfile = rpc.declare({ object: 'luci.clashoo', method: 'get_singbox_profile', params: ['name'], expect: {} });
|
||||
const callGetSingboxProfileChunk = rpc.declare({ object: 'luci.clashoo', method: 'get_singbox_profile_chunk', params: ['name', 'index'], expect: {} });
|
||||
const callSaveSingboxProfileChunk = rpc.declare({ object: 'luci.clashoo', method: 'save_singbox_profile_chunk', params: ['name', 'content', 'index', 'total'], expect: {} });
|
||||
const callSaveSingboxProfileChunk = rpc.declare({ object: 'luci.clashoo', method: 'save_singbox_profile_chunk', params: ['name', 'content', 'index', 'total', 'upload'], expect: {} });
|
||||
const callSetSingboxProfile = rpc.declare({ object: 'luci.clashoo', method: 'set_singbox_profile', params: ['name'], expect: {} });
|
||||
const callDeleteSingboxProfile = rpc.declare({ object: 'luci.clashoo', method: 'delete_singbox_profile', params: ['name'], expect: {} });
|
||||
const callCreateSingboxConfig = rpc.declare({ object: 'luci.clashoo', method: 'create_singbox_config', params: ['sub_url', 'name'], expect: {} });
|
||||
const callCreateSingboxConfig = rpc.declare({ object: 'luci.clashoo', method: 'create_singbox_config', params: ['sub_url', 'name', 'converter'], expect: {} });
|
||||
const callCommitConfig = rpc.declare({ object: 'luci.clashoo', method: 'commit_config', expect: {} });
|
||||
const callDnsAutoSetup = rpc.declare({ object: 'luci.clashoo', method: 'dns_auto_setup', expect: {} });
|
||||
const callFetchSingboxNative = rpc.declare({ object: 'luci.clashoo', method: 'fetch_singbox_native', params: ['url', 'name'], expect: {} });
|
||||
@@ -292,12 +292,16 @@ return baseclass.extend({
|
||||
if (!chunks.length) chunks.push('');
|
||||
var total = chunks.length;
|
||||
var index = 0;
|
||||
var upload = '';
|
||||
|
||||
function sendNext() {
|
||||
var chunk = chunks[index];
|
||||
return L.resolveDefault(callSaveSingboxProfileChunk(name, chunk, String(index), String(total)), {}).then(function (r) {
|
||||
return L.resolveDefault(callSaveSingboxProfileChunk(name, chunk, String(index), String(total), upload), {}).then(function (r) {
|
||||
if (!r || !r.success)
|
||||
return { success: false, error: (r && r.error) || 'upload_failed', message: (r && (r.message || r.error)) || _('Upload failed') };
|
||||
if (index === 0 && index + 1 < total && !r.upload)
|
||||
return { success: false, error: 'upload_failed', message: _('Upload failed') };
|
||||
if (r.upload) upload = r.upload;
|
||||
index++;
|
||||
return index < total ? sendNext() : r;
|
||||
});
|
||||
@@ -307,7 +311,7 @@ return baseclass.extend({
|
||||
},
|
||||
setSingboxProfile: function (name) { return L.resolveDefault(callSetSingboxProfile(name), {}); },
|
||||
deleteSingboxProfile: function (name) { return L.resolveDefault(callDeleteSingboxProfile(name), {}); },
|
||||
createSingboxConfig: function (url, name) { return L.resolveDefault(callCreateSingboxConfig(url, name), {}); },
|
||||
createSingboxConfig: function (url, name, converter) { return L.resolveDefault(callCreateSingboxConfig(url, name, converter || ''), {}); },
|
||||
commitConfig: function () { return L.resolveDefault(callCommitConfig(), { success: false }); },
|
||||
dnsAutoSetup: function () { return L.resolveDefault(callDnsAutoSetup(), { success: false }); },
|
||||
fetchSingboxNative: function (url, name) { return L.resolveDefault(callFetchSingboxNative(url, name), {}); },
|
||||
|
||||
@@ -1817,7 +1817,7 @@ return view.extend({
|
||||
});
|
||||
}
|
||||
}, _("Switch Profile")),
|
||||
p.source === 'native' && p.sub_url ? E('button', {
|
||||
p.source === 'native' ? E('button', {
|
||||
'class': 'btn cbi-button cl-btn-sm cl-btn-sb-action',
|
||||
click: function (ev) {
|
||||
var btn = ev.currentTarget;
|
||||
@@ -1898,6 +1898,12 @@ return view.extend({
|
||||
try { savedUa = uci.get('clashoo', 'config', 'sub_ua') || ''; } catch (e) {}
|
||||
// YAML 订阅转换走 mihomo 订阅流程(拉 yaml → yaml2singbox),UA 与 mihomo 共用 sub_ua
|
||||
var convertUaPicker = buildUaPicker(savedUa);
|
||||
var converterSelect = E('select', { 'class': 'cl-sub-url', style: 'margin-top:0' }, [
|
||||
E('option', { value: '' }, _("Local conversion only")),
|
||||
E('option', { value: 'kidsqq' }, 'sub.kidsqq.cn'),
|
||||
E('option', { value: 'xeton' }, 'sub.xeton.dev'),
|
||||
E('option', { value: 'v1mk' }, 'api.v1.mk')
|
||||
]);
|
||||
|
||||
var genBtn, applyBtn;
|
||||
function setBusy(busy, activeBtn) {
|
||||
@@ -1925,7 +1931,7 @@ return view.extend({
|
||||
.then(function () { return clearClashooDirty(); });
|
||||
}).catch(function () {});
|
||||
uaPromise.then(function () {
|
||||
return clashoo.createSingboxConfig(url, nameInput.value.trim());
|
||||
return clashoo.createSingboxConfig(url, nameInput.value.trim(), converterSelect.value);
|
||||
})
|
||||
.then(function (r) {
|
||||
/* RPC 超时被 resolveDefault 兜底成 {},r.success 是 undefined。
|
||||
@@ -2050,7 +2056,10 @@ return view.extend({
|
||||
E('div', { 'class': 'cl-section cl-card cl-sb-card' }, [
|
||||
E('h4', {}, _("YAML Subscription Conversion")),
|
||||
E('div', { 'class': 'cl-form-wrap cl-fixed-600 cl-sb-form' }, [
|
||||
urlInput, nameInput, convertUaPicker.wrap,
|
||||
urlInput, nameInput, convertUaPicker.wrap, converterSelect,
|
||||
E('p', { 'class': 'cl-sb-note' },
|
||||
_("If local conversion fails, the selected external service receives the complete subscription URL, including its access token. Leave Local conversion only selected to keep the URL on this router.")
|
||||
),
|
||||
E('div', { 'class': 'cl-actions cl-sb-top-actions' }, [
|
||||
genBtn,
|
||||
applyBtn
|
||||
|
||||
Reference in new issue
Block a user