Skip to content

Commit

Permalink
Merge pull request #1 from rtaserver/main
Browse files Browse the repository at this point in the history
Marge Main To Mod
  • Loading branch information
rtaserver authored Oct 7, 2024
2 parents 2c35c5f + c614eda commit 75452c7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
41 changes: 20 additions & 21 deletions luci-app-mihomo/htdocs/luci-static/resources/view/mihomo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ return view.extend({

s.tab('general', _('General Config'));

o = s.taboption('general', form.ListValue, 'log_level', _('Log Level'));
o = s.taboption('general', form.ListValue, 'log_level', '*' + ' ' + _('Log Level'));
o.value('silent');
o.value('error');
o.value('warning');
Expand All @@ -269,11 +269,10 @@ return view.extend({
o.value('always', _('Enable'));
o.value('off', _('Disable'));

o = s.taboption('general', widgets.NetworkSelect, 'outbound_interface', _('Outbound Interface'));
o = s.taboption('general', widgets.NetworkSelect, 'outbound_interface', '*' + ' ' + _('Outbound Interface'));
o.optional = true;
o.rmempty = false;

o = s.taboption('general', form.Flag, 'ipv6', _('IPv6'));
o = s.taboption('general', form.Flag, 'ipv6', '*' + ' ' + _('IPv6'));
o.rmempty = false;

o = s.taboption('general', form.Value, 'tcp_keep_alive_idle', _('TCP Keep Alive Idle'));
Expand All @@ -286,51 +285,51 @@ return view.extend({

s.tab('external_control', _('External Control Config'));

o = s.taboption('external_control', form.Value, 'ui_name', _('UI Name'));
o = s.taboption('external_control', form.Value, 'ui_name', '*' + ' ' + _('UI Name'));
o.rmempty = false;

o = s.taboption('external_control', form.Value, 'ui_url', _('UI Url'));
o = s.taboption('external_control', form.Value, 'ui_url', '*' + ' ' + _('UI Url'));
o.rmempty = false;
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip', 'MetaCubeXD')
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip', 'YACD')
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/Razord-meta/archive/refs/heads/gh-pages.zip', 'Razord')

o = s.taboption('external_control', form.Value, 'api_port', _('API Port'));
o = s.taboption('external_control', form.Value, 'api_port', '*' + ' ' + _('API Port'));
o.datatype = 'port';
o.placeholder = '9090';

o = s.taboption('external_control', form.Value, 'api_secret', _('API Secret'));
o = s.taboption('external_control', form.Value, 'api_secret', '*' + ' ' + _('API Secret'));
o.rmempty = false;

o = s.taboption('external_control', form.Flag, 'selection_cache', _('Save Proxy Selection'));
o.rmempty = false;

s.tab('inbound', _('Inbound Config'));

o = s.taboption('inbound', form.Flag, 'allow_lan', _('Allow Lan'));
o = s.taboption('inbound', form.Flag, 'allow_lan', '*' + ' ' + _('Allow Lan'));
o.rmempty = false;

o = s.taboption('inbound', form.Value, 'http_port', _('HTTP Port'));
o = s.taboption('inbound', form.Value, 'http_port', '*' + ' ' + _('HTTP Port'));
o.datatype = 'port';
o.placeholder = '8080';

o = s.taboption('inbound', form.Value, 'socks_port', _('SOCKS Port'));
o = s.taboption('inbound', form.Value, 'socks_port', '*' + ' ' + _('SOCKS Port'));
o.datatype = 'port';
o.placeholder = '1080';

o = s.taboption('inbound', form.Value, 'mixed_port', _('Mixed Port'));
o = s.taboption('inbound', form.Value, 'mixed_port', '*' + ' ' + _('Mixed Port'));
o.datatype = 'port';
o.placeholder = '7890';

o = s.taboption('inbound', form.Value, 'redir_port', _('Redirect Port'));
o = s.taboption('inbound', form.Value, 'redir_port', '*' + ' ' + _('Redirect Port'));
o.datatype = 'port';
o.placeholder = '7891';

o = s.taboption('inbound', form.Value, 'tproxy_port', _('TPROXY Port'));
o = s.taboption('inbound', form.Value, 'tproxy_port', '*' + ' ' + _('TPROXY Port'));
o.datatype = 'port';
o.placeholder = '7892';

o = s.taboption('inbound', form.Flag, 'authentication', _('Authentication'));
o = s.taboption('inbound', form.Flag, 'authentication', '*' + ' ' + _('Overwrite Authentication'));
o.rmempty = false;

o = s.taboption('inbound', form.SectionValue, '_authentications', form.TableSection, 'authentication', _('Edit Authentications'));
Expand All @@ -351,27 +350,27 @@ return view.extend({

s.tab('tun', _('TUN Config'));

o = s.taboption('tun', form.ListValue, 'tun_stack', _('Stack'));
o = s.taboption('tun', form.ListValue, 'tun_stack', '*' + ' ' + _('Stack'));
o.value('system', 'System');
o.value('gvisor', 'gVisor');
o.value('mixed', 'Mixed');

o = s.taboption('tun', form.Value, 'tun_mtu', _('MTU'));
o = s.taboption('tun', form.Value, 'tun_mtu', '*' + ' ' + _('MTU'));
o.placeholder = '9000';

o = s.taboption('tun', form.Flag, 'tun_gso', _('GSO'));
o = s.taboption('tun', form.Flag, 'tun_gso', '*' + ' ' + _('GSO'));
o.rmempty = false;

o = s.taboption('tun', form.Value, 'tun_gso_max_size', _('GSO Max Size'));
o = s.taboption('tun', form.Value, 'tun_gso_max_size', '*' + ' ' + _('GSO Max Size'));
o.placeholder = '65536';
o.depends('tun_gso', '1');

o = s.taboption('tun', form.Flag, 'tun_endpoint_independent_nat', _('Endpoint Independent NAT'));
o = s.taboption('tun', form.Flag, 'tun_endpoint_independent_nat', '*' + ' ' + _('Endpoint Independent NAT'));
o.rmempty = false;

s.tab('dns', _('DNS Config'));

o = s.taboption('dns', form.Value, 'dns_port', _('DNS Port'));
o = s.taboption('dns', form.Value, 'dns_port', '*' + ' ' + _('DNS Port'));
o.datatype = 'port';
o.placeholder = '1053';

Expand Down
4 changes: 2 additions & 2 deletions luci-app-mihomo/po/zh_Hans/mihomo.po
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ msgstr "Redirect 端口"
msgid "TPROXY Port"
msgstr "TPROXY 端口"

msgid "Authentication"
msgid "身份验证"
msgid "Overwrite Authentication"
msgstr "覆盖身份验证"

msgid "Edit Authentications"
msgstr "编辑身份验证"
Expand Down
18 changes: 9 additions & 9 deletions mihomo/files/mihomo.init
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ start_service() {
# do mixin
log_level="$log_level" ipv6="$ipv6" \
ui_path="ui" ui_name="$ui_name" ui_url="$ui_url" api_listen="0.0.0.0:$api_port" api_secret="$api_secret" \
http_port="$http_port" socks_port="$socks_port" mixed_port="$mixed_port" redir_port="$redir_port" tproxy_port="$tproxy_port" \
allow_lan="$allow_lan" http_port="$http_port" socks_port="$socks_port" mixed_port="$mixed_port" redir_port="$redir_port" tproxy_port="$tproxy_port" \
tun_enable="$tun_enable" tun_stack="$tun_stack" tun_device="$TUN_DEVICE" tun_mtu="$tun_mtu" tun_gso="$tun_gso" tun_gso_max_size="$tun_gso_max_size" tun_endpoint_independent_nat="$tun_endpoint_independent_nat" \
dns_enable="true" dns_listen="0.0.0.0:$dns_port" \
yq -M -i '
.log-level = env(log_level) | .ipv6 = env(ipv6) == 1 |
.external-ui = env(ui_path) | .external-ui-name = env(ui_name) | .external-ui-url = env(ui_url) | .external-controller = env(api_listen) | .secret = env(api_secret) |
.port = env(http_port) | .socks-port = env(socks_port) | .mixed-port = env(mixed_port) | .redir-port = env(redir_port) | .tproxy-port = env(tproxy_port) |
.allow-lan = env(allow_lan) == 1 | .port = env(http_port) | .socks-port = env(socks_port) | .mixed-port = env(mixed_port) | .redir-port = env(redir_port) | .tproxy-port = env(tproxy_port) |
.tun.enable = env(tun_enable) == 1 | .tun.stack = env(tun_stack) | .tun.device = env(tun_device) | .tun.mtu = env(tun_mtu) | .tun.gso = env(tun_gso) == 1 | .tun.gso-max-size = env(tun_gso_max_size) | .tun.endpoint-independent-nat = env(tun_endpoint_independent_nat) == 1 |
.dns.enable = env(dns_enable) | .dns.listen = env(dns_listen)
' "$RUN_PROFILE_PATH"
Expand All @@ -178,10 +178,6 @@ start_service() {
.geo-auto-update = env(geox_auto_update) == 1 | .geo-update-interval = env(geox_update_interval)
' "$RUN_PROFILE_PATH"

if [ "$authentication" == 1 ]; then
yq -M -i 'del(.authentication)' "$RUN_PROFILE_PATH"
config_foreach mixin_authentications "authentication"
fi
if [ "$fake_ip_filter" == 1 ]; then
fake_ip_filter_mode="$fake_ip_filter_mode" \
yq -M -i 'del(.dns.fake-ip-filter) | .dns.fake-ip-filter-mode = env(fake_ip_filter_mode)' "$RUN_PROFILE_PATH"
Expand All @@ -205,16 +201,20 @@ start_service() {
fi
fi
yq -M -i 'del (.bind-address)' "$RUN_PROFILE_PATH"
if [ "$tun_enable" == 1 ]; then
yq -M -i '.tun.auto-route = false | .tun.auto-redirect = false | .tun.auto-detect-interface = false | .tun.dns-hijack = []' "$RUN_PROFILE_PATH"
fi
if [ -n "$outbound_interface" ]; then
local outbound_device
network_get_device outbound_device "$outbound_interface"
if [ -n "$outbound_device" ]; then
outbound_device="$outbound_device" yq -M -i '.interface-name = env(outbound_device)' "$RUN_PROFILE_PATH"
fi
fi
if [ "$authentication" == 1 ]; then
yq -M -i 'del(.authentication)' "$RUN_PROFILE_PATH"
config_foreach mixin_authentications "authentication"
fi
if [ "$tun_enable" == 1 ]; then
yq -M -i '.tun.auto-route = false | .tun.auto-redirect = false | .tun.auto-detect-interface = false | .tun.dns-hijack = []' "$RUN_PROFILE_PATH"
fi
# test profile
if [ "$test_profile" == 1 ]; then
log "Profile testing..."
Expand Down

0 comments on commit 75452c7

Please sign in to comment.