Skip to content

Commit

Permalink
Merge pull request #8 from rtaserver/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
rtaserver authored Oct 15, 2024
2 parents 96cb06a + 5f8f001 commit 6064d90
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
push:
tags:
- v*

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion luci-app-mihomo/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include $(TOPDIR)/rules.mk

PKG_VERSION:=1.8.6
PKG_VERSION:=1.8.7

LUCI_TITLE:=LuCI Support for mihomo
LUCI_DEPENDS:=+luci-base +mihomo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ return view.extend({
o.retain = true;
o.depends('geox_auto_update', '1');

s.tab('mixin_file_content', _('Mixin File Content'), _('Please go to the editor tab to edit the file for mixin'));
s.tab('mixin_file_content', _('Mixin File Content'));

o = s.taboption('mixin_file_content', form.HiddenValue, '_mixin_file_content');
o = s.taboption('mixin_file_content', form.Flag, 'mixin_file_content', '*' + ' ' + _('Enable'), _('Please go to the editor tab to edit the file for mixin'));

return m.render();
}
Expand Down
1 change: 1 addition & 0 deletions mihomo/files/mihomo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ config mixin 'mixin'
option 'geoip_asn_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
option 'geox_auto_update' '0'
option 'geox_update_interval' '24'
option 'mixin_file_content' '0'

config authentication
option 'enabled' '1'
Expand Down
12 changes: 8 additions & 4 deletions mihomo/files/mihomo.init
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ start_service() {
config_get geoip_asn_url "mixin" "geoip_asn_url"
config_get_bool geox_auto_update "mixin" "geox_auto_update" 0
config_get geox_update_interval "mixin" "geox_update_interval" "24"
### mixin file content
local mixin_file_content
config_get_bool mixin_file_content "mixin" "mixin_file_content" 0
# prepare
local tproxy_enable; tproxy_enable=0
if [[ "$tcp_transparent_proxy_mode" == "tproxy" || "$udp_transparent_proxy_mode" == "tproxy" ]]; then
Expand Down Expand Up @@ -195,10 +198,6 @@ start_service() {
yq -M -i 'del(.dns.nameserver-policy)' "$RUN_PROFILE_PATH"
config_foreach mixin_nameserver_policies "nameserver_policy"
fi
# mixin file
if [ -s "$MIXIN_FILE_PATH" ]; then
yq ea -M -i '. as $item ireduce ({}; . * $item ) | ... comments=""' "$RUN_PROFILE_PATH" "$MIXIN_FILE_PATH"
fi
fi
yq -M -i 'del (.bind-address)' "$RUN_PROFILE_PATH"
if [ -n "$outbound_interface" ]; then
Expand All @@ -215,6 +214,11 @@ start_service() {
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 [ "$mixin_file_content" == 1 ]; then
if [ -s "$MIXIN_FILE_PATH" ]; then
yq ea -M -i '. as $item ireduce ({}; . * $item ) | ... comments=""' "$RUN_PROFILE_PATH" "$MIXIN_FILE_PATH"
fi
fi
# test profile
if [ "$test_profile" == 1 ]; then
log "Profile testing..."
Expand Down
3 changes: 2 additions & 1 deletion mihomo/files/nftables/hijack.nft
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ table inet mihomo {
}

chain router_dns_hijack {
meta nfproto @dns_hijack_nfproto meta l4proto { tcp, udp } th dport 53 oifname lo meta skuid != $MIHOMO_USER counter redirect to :$DNS_PORT
meta skuid $MIHOMO_USER counter return
meta nfproto @dns_hijack_nfproto meta l4proto { tcp, udp } th dport 53 oifname lo counter redirect to :$DNS_PORT
}

chain all_dns_hijack {
Expand Down
4 changes: 4 additions & 0 deletions mihomo/files/uci-defaults/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

dns_doh_prefer_http3=$(uci -q get mihomo.mixin.dns_doh_prefer_http3); [ -z "$dns_doh_prefer_http3" ] && uci set mihomo.mixin.dns_doh_prefer_http3=0

# since v1.8.7

mixin_file_content=$(uci -q get mihomo.mixin.mixin_file_content); [ -z "$mixin_file_content" ] && uci set mihomo.mixin.mixin_file_content=$(uci -q get mihomo.config.mixin)

# commit
uci commit mihomo

Expand Down

0 comments on commit 6064d90

Please sign in to comment.