From 3584da627757d7562b7e438bfe60cbb5c0ad78d2 Mon Sep 17 00:00:00 2001 From: "github-action[bot]" Date: Sun, 16 Nov 2025 19:35:43 +0100 Subject: [PATCH] Update On Sun Nov 16 19:35:42 CET 2025 --- .github/update.log | 1 + clash-nyanpasu/manifest/version.json | 4 +- filebrowser/.github/workflows/ci.yaml | 2 +- filebrowser/CHANGELOG.md | 13 + filebrowser/CONTRIBUTING.md | 2 +- filebrowser/Taskfile.yml | 35 +- filebrowser/cmd/config.go | 10 +- filebrowser/cmd/config_init.go | 14 + filebrowser/cmd/config_set.go | 4 + filebrowser/cmd/docs.go | 158 +-- filebrowser/cmd/root.go | 14 +- filebrowser/cmd/upgrade.go | 40 - filebrowser/cmd/utils.go | 1 - filebrowser/errors/errors.go | 54 - filebrowser/frontend/pnpm-lock.yaml | 16 +- filebrowser/go.mod | 6 +- filebrowser/go.sum | 2 + filebrowser/main.go | 3 +- filebrowser/storage/bolt/importer/conf.go | 187 --- filebrowser/storage/bolt/importer/importer.go | 39 - filebrowser/storage/bolt/importer/users.go | 114 -- filebrowser/www/docs/authentication.md | 49 + .../www/docs/cli/filebrowser-cmds-add.md | 29 + .../www/docs/cli/filebrowser-cmds-ls.md | 30 + .../www/docs/cli/filebrowser-cmds-rm.md | 37 + filebrowser/www/docs/cli/filebrowser-cmds.md | 28 + .../docs/cli/filebrowser-completion-bash.md | 50 + .../docs/cli/filebrowser-completion-fish.md | 41 + .../cli/filebrowser-completion-powershell.md | 38 + .../docs/cli/filebrowser-completion-zsh.md | 52 + .../www/docs/cli/filebrowser-completion.md | 31 + .../www/docs/cli/filebrowser-config-cat.md | 29 + .../www/docs/cli/filebrowser-config-export.md | 31 + .../www/docs/cli/filebrowser-config-import.md | 36 + .../www/docs/cli/filebrowser-config-init.md | 89 ++ .../www/docs/cli/filebrowser-config-set.md | 86 ++ .../www/docs/cli/filebrowser-config.md | 30 + filebrowser/www/docs/cli/filebrowser-hash.md | 29 + .../www/docs/cli/filebrowser-rules-add.md | 33 + .../www/docs/cli/filebrowser-rules-ls.md | 31 + .../www/docs/cli/filebrowser-rules-rm.md | 40 + filebrowser/www/docs/cli/filebrowser-rules.md | 34 + .../www/docs/cli/filebrowser-users-add.md | 48 + .../www/docs/cli/filebrowser-users-export.md | 30 + .../www/docs/cli/filebrowser-users-find.md | 29 + .../www/docs/cli/filebrowser-users-import.md | 34 + .../www/docs/cli/filebrowser-users-ls.md | 25 + .../www/docs/cli/filebrowser-users-rm.md | 29 + .../www/docs/cli/filebrowser-users-update.md | 51 + filebrowser/www/docs/cli/filebrowser-users.md | 32 + .../www/docs/cli/filebrowser-version.md | 25 + filebrowser/www/docs/cli/filebrowser.md | 83 ++ filebrowser/www/docs/command-execution.md | 54 + filebrowser/www/docs/configuration.md | 158 --- filebrowser/www/docs/customization.md | 45 + filebrowser/www/docs/installation.md | 2 +- filebrowser/www/mkdocs.yml | 41 +- .../target/linux/mediatek/filogic/config-6.12 | 2 + lede/target/linux/mediatek/mt7622/config-6.12 | 2 + lede/target/linux/mediatek/mt7623/config-6.12 | 1 + lede/target/linux/mediatek/mt7629/config-6.12 | 1 + ...-mediatek-add-mt7987-pinctrl-support.patch | 793 +++++++++++ ...tek-add-mt7987-clock-drivers-support.patch | 1190 +++++++++++++++++ ...ernet-mtk_eth_soc-add-mt7987-support.patch | 4 +- .../821-add-pwm-feature-for-mt7987.patch | 44 + mieru/pkg/protocol/session.go | 17 +- mieru/pkg/protocol/underlay_base.go | 2 +- openwrt-packages/filebrowser/Makefile | 4 +- .../luasrc/controller/passwall.lua | 8 +- .../luasrc/view/passwall/haproxy/status.htm | 32 +- .../view/passwall/node_list/link_add_node.htm | 19 +- .../view/passwall/node_list/node_list.htm | 37 +- .../root/usr/share/passwall/rule_update.lua | 8 - .../root/usr/share/passwall/rules/chnlist | 20 +- .../root/usr/share/passwall/rules/chnroute | 73 +- .../root/usr/share/passwall/rules/chnroute6 | 131 +- .../root/usr/share/passwall/rules/gfwlist | 34 +- .../luasrc/controller/passwall2.lua | 23 +- .../model/cbi/passwall2/client/global.lua | 18 +- .../cbi/passwall2/client/node_subscribe.lua | 2 +- .../client/node_subscribe_config.lua | 2 +- .../model/cbi/passwall2/client/rule.lua | 7 + .../cbi/passwall2/client/shunt_rules.lua | 8 +- .../luasrc/passwall2/api.lua | 2 +- .../luasrc/passwall2/util_sing-box.lua | 3 + .../view/passwall2/app_update/app_version.htm | 5 +- .../luasrc/view/passwall2/haproxy/status.htm | 32 +- .../passwall2/node_list/link_add_node.htm | 19 +- .../view/passwall2/node_list/node_list.htm | 52 +- .../luci-app-passwall2/po/zh-cn/passwall2.po | 14 +- .../luci-app-passwall2/po/zh-tw/passwall2.po | 14 +- shadowsocks-rust/Cargo.lock | 449 +++---- shadowsocks-rust/Cargo.toml | 1 + shadowsocks-rust/README.md | 11 + shadowsocks-rust/build/build-release | 2 +- shadowsocks-rust/src/config.rs | 21 + shadowsocks-rust/src/logging/tracing.rs | 75 +- small/gn/Makefile | 6 +- small/gn/src/out/last_commit_position.h | 4 +- .../luasrc/controller/passwall.lua | 22 +- .../luasrc/view/passwall/haproxy/status.htm | 32 +- .../view/passwall/node_list/link_add_node.htm | 19 +- .../view/passwall/node_list/node_list.htm | 53 +- .../root/usr/share/passwall/rule_update.lua | 8 - .../root/usr/share/passwall/rules/chnlist | 20 +- .../root/usr/share/passwall/rules/chnroute | 73 +- .../root/usr/share/passwall/rules/chnroute6 | 131 +- .../root/usr/share/passwall/rules/gfwlist | 34 +- .../luasrc/controller/passwall2.lua | 23 +- .../model/cbi/passwall2/client/global.lua | 18 +- .../cbi/passwall2/client/node_subscribe.lua | 2 +- .../client/node_subscribe_config.lua | 2 +- .../model/cbi/passwall2/client/rule.lua | 7 + .../cbi/passwall2/client/shunt_rules.lua | 8 +- .../luasrc/passwall2/api.lua | 2 +- .../luasrc/passwall2/util_sing-box.lua | 3 + .../view/passwall2/app_update/app_version.htm | 5 +- .../luasrc/view/passwall2/haproxy/status.htm | 32 +- .../passwall2/node_list/link_add_node.htm | 19 +- .../view/passwall2/node_list/node_list.htm | 52 +- .../luci-app-passwall2/po/zh-cn/passwall2.po | 14 +- .../luci-app-passwall2/po/zh-tw/passwall2.po | 14 +- .../luci-app-ssr-plus/root/usr/bin/ssr-rules | 381 ++++-- .../root/usr/share/shadowsocksr/chinaipset.sh | 23 +- .../root/usr/share/shadowsocksr/gfw2ipset.sh | 18 +- v2rayn/v2rayN/ServiceLib/Common/Utils.cs | 2 +- .../v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs | 6 +- .../v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 11 +- .../v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 5 +- v2rayn/v2rayN/ServiceLib/Resx/ResUI.fr.resx | 5 +- v2rayn/v2rayN/ServiceLib/Resx/ResUI.hu.resx | 5 +- v2rayn/v2rayN/ServiceLib/Resx/ResUI.resx | 5 +- v2rayn/v2rayN/ServiceLib/Resx/ResUI.ru.resx | 5 +- .../v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 5 +- .../v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 5 +- .../Singbox/SingboxRoutingService.cs | 2 +- .../ServiceLib/Services/SpeedtestService.cs | 52 +- v2rayng/V2rayNG/app/build.gradle.kts | 4 +- .../app/src/main/assets/custom_routing_black | 17 +- .../app/src/main/assets/custom_routing_white | 17 +- yt-dlp/yt_dlp/downloader/common.py | 3 +- yt-dlp/yt_dlp/extractor/_extractors.py | 1 + yt-dlp/yt_dlp/extractor/soundcloud.py | 8 +- yt-dlp/yt_dlp/extractor/yfanefa.py | 67 + 144 files changed, 5042 insertions(+), 1648 deletions(-) delete mode 100644 filebrowser/cmd/upgrade.go delete mode 100644 filebrowser/storage/bolt/importer/conf.go delete mode 100644 filebrowser/storage/bolt/importer/importer.go delete mode 100644 filebrowser/storage/bolt/importer/users.go create mode 100644 filebrowser/www/docs/authentication.md create mode 100644 filebrowser/www/docs/cli/filebrowser-cmds-add.md create mode 100644 filebrowser/www/docs/cli/filebrowser-cmds-ls.md create mode 100644 filebrowser/www/docs/cli/filebrowser-cmds-rm.md create mode 100644 filebrowser/www/docs/cli/filebrowser-cmds.md create mode 100644 filebrowser/www/docs/cli/filebrowser-completion-bash.md create mode 100644 filebrowser/www/docs/cli/filebrowser-completion-fish.md create mode 100644 filebrowser/www/docs/cli/filebrowser-completion-powershell.md create mode 100644 filebrowser/www/docs/cli/filebrowser-completion-zsh.md create mode 100644 filebrowser/www/docs/cli/filebrowser-completion.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config-cat.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config-export.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config-import.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config-init.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config-set.md create mode 100644 filebrowser/www/docs/cli/filebrowser-config.md create mode 100644 filebrowser/www/docs/cli/filebrowser-hash.md create mode 100644 filebrowser/www/docs/cli/filebrowser-rules-add.md create mode 100644 filebrowser/www/docs/cli/filebrowser-rules-ls.md create mode 100644 filebrowser/www/docs/cli/filebrowser-rules-rm.md create mode 100644 filebrowser/www/docs/cli/filebrowser-rules.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-add.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-export.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-find.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-import.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-ls.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-rm.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users-update.md create mode 100644 filebrowser/www/docs/cli/filebrowser-users.md create mode 100644 filebrowser/www/docs/cli/filebrowser-version.md create mode 100644 filebrowser/www/docs/cli/filebrowser.md create mode 100644 filebrowser/www/docs/command-execution.md delete mode 100644 filebrowser/www/docs/configuration.md create mode 100644 filebrowser/www/docs/customization.md create mode 100644 lede/target/linux/mediatek/patches-6.12/360-pinctrl-mediatek-add-mt7987-pinctrl-support.patch create mode 100644 lede/target/linux/mediatek/patches-6.12/361-clk-mediatek-add-mt7987-clock-drivers-support.patch create mode 100644 lede/target/linux/mediatek/patches-6.12/821-add-pwm-feature-for-mt7987.patch create mode 100644 yt-dlp/yt_dlp/extractor/yfanefa.py diff --git a/.github/update.log b/.github/update.log index 3c2b0f6ca5..72af4d1403 100644 --- a/.github/update.log +++ b/.github/update.log @@ -1183,3 +1183,4 @@ Update On Wed Nov 12 19:37:25 CET 2025 Update On Thu Nov 13 19:41:20 CET 2025 Update On Fri Nov 14 19:38:12 CET 2025 Update On Sat Nov 15 19:34:45 CET 2025 +Update On Sun Nov 16 19:35:35 CET 2025 diff --git a/clash-nyanpasu/manifest/version.json b/clash-nyanpasu/manifest/version.json index 7a1c1e1db7..f00e0c0d78 100644 --- a/clash-nyanpasu/manifest/version.json +++ b/clash-nyanpasu/manifest/version.json @@ -2,7 +2,7 @@ "manifest_version": 1, "latest": { "mihomo": "v1.19.16", - "mihomo_alpha": "alpha-f6e494e", + "mihomo_alpha": "alpha-c107c6a", "clash_rs": "v0.9.2", "clash_premium": "2023-09-05-gdcc8d87", "clash_rs_alpha": "0.9.2-alpha+sha.87c7b2c" @@ -69,5 +69,5 @@ "linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf" } }, - "updated_at": "2025-11-13T22:21:28.265Z" + "updated_at": "2025-11-15T22:20:39.678Z" } diff --git a/filebrowser/.github/workflows/ci.yaml b/filebrowser/.github/workflows/ci.yaml index 0f222ecdaf..b389be5f6a 100644 --- a/filebrowser/.github/workflows/ci.yaml +++ b/filebrowser/.github/workflows/ci.yaml @@ -97,7 +97,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Install Task uses: go-task/setup-task@v1 - - run: task build-frontend + - run: task build:frontend - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/filebrowser/CHANGELOG.md b/filebrowser/CHANGELOG.md index 70d61c7128..5c25523b7f 100644 --- a/filebrowser/CHANGELOG.md +++ b/filebrowser/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [2.47.0](https://github.com/filebrowser/filebrowser/compare/v2.46.1...v2.47.0) (2025-11-16) + + +### Features + +* add TUS settings to the command line ([#5556](https://github.com/filebrowser/filebrowser/issues/5556)) ([e24e1f1](https://github.com/filebrowser/filebrowser/commit/e24e1f1abae9e80add620c4ad65660ca1b575a49)) +* remove importer of v1 config ([#5550](https://github.com/filebrowser/filebrowser/issues/5550)) ([ceb5e72](https://github.com/filebrowser/filebrowser/commit/ceb5e723f3ee2c966bb561a804015246450280ca)) + + +### Bug Fixes + +* exit 0 when gracefully shutting down ([#5555](https://github.com/filebrowser/filebrowser/issues/5555)) ([5de4099](https://github.com/filebrowser/filebrowser/commit/5de4099cba2cf012d4a213c8eb29c412fc72c151)) + ## [2.46.1](https://github.com/filebrowser/filebrowser/compare/v2.46.0...v2.46.1) (2025-11-15) diff --git a/filebrowser/CONTRIBUTING.md b/filebrowser/CONTRIBUTING.md index d6e694f1e6..311a2fd708 100644 --- a/filebrowser/CONTRIBUTING.md +++ b/filebrowser/CONTRIBUTING.md @@ -86,7 +86,7 @@ task docs To start a local server on port `8000` to view the built documentation: ```bash -task docs-serve +task docs:serve ``` ## Release diff --git a/filebrowser/Taskfile.yml b/filebrowser/Taskfile.yml index 9721317f78..5977dff009 100644 --- a/filebrowser/Taskfile.yml +++ b/filebrowser/Taskfile.yml @@ -10,14 +10,14 @@ vars: -v ./CONTRIBUTING.md:/docs/docs/contributing.md tasks: - build-frontend: + build:frontend: desc: Build frontend assets dir: frontend cmds: - pnpm install --frozen-lockfile - pnpm run build - build-backend: + build:backend: desc: Build backend binary cmds: - go build -ldflags='-s -w -X "github.com/filebrowser/filebrowser/v2/version.Version={{.VERSION}}" -X "github.com/filebrowser/filebrowser/v2/version.CommitSHA={{.GIT_COMMIT}}"' -o filebrowser . @@ -30,16 +30,16 @@ tasks: build: desc: Build both frontend and backend cmds: - - task: build-frontend - - task: build-backend + - task: build:frontend + - task: build:backend - release-make: + release:make: internal: true prompt: Do you wish to proceed? cmds: - pnpm dlx commit-and-tag-version -s - release-dry-run: + release:dry-run: internal: true cmds: - pnpm dlx commit-and-tag-version --dry-run --skip @@ -47,10 +47,21 @@ tasks: release: desc: Create a new release cmds: - - task: release-dry-run - - task: release-make + - task: docs:cli:generate + - git add www/docs/cli + - "git commit -m 'chore(docs): update CLI documentation'" + - task: release:dry-run + - task: release:make - docs-image-make: + docs:cli:generate: + cmds: + - rm -rf www/docs/cli + - mkdir -p www/docs/cli + - go run . docs + generates: + - www/docs/cli + + docs:docker:generate: internal: true cmds: - docker build -f www/Dockerfile --progress=plain -t filebrowser.site www @@ -59,11 +70,11 @@ tasks: desc: Generate documentation cmds: - rm -rf www/public - - task: docs-image-make + - task: docs:docker:generate - docker run --rm {{.SITE_DOCKER_FLAGS}} filebrowser.site build -d "public" - docs-serve: + docs:serve: desc: Serve documentation cmds: - - task: docs-image-make + - task: docs:docker:generate - docker run --rm -it -p 8000:8000 {{.SITE_DOCKER_FLAGS}} filebrowser.site diff --git a/filebrowser/cmd/config.go b/filebrowser/cmd/config.go index 84474f4c1d..6b73961043 100644 --- a/filebrowser/cmd/config.go +++ b/filebrowser/cmd/config.go @@ -52,8 +52,11 @@ func addConfigFlags(flags *pflag.FlagSet) { flags.Bool("branding.disableUsedPercentage", false, "disable used disk percentage graph") // NB: these are string so they can be presented as octal in the help text // as that's the conventional representation for modes in Unix. - flags.String("file-mode", fmt.Sprintf("%O", settings.DefaultFileMode), "Mode bits that new files are created with") - flags.String("dir-mode", fmt.Sprintf("%O", settings.DefaultDirMode), "Mode bits that new directories are created with") + flags.String("file-mode", fmt.Sprintf("%O", settings.DefaultFileMode), "mode bits that new files are created with") + flags.String("dir-mode", fmt.Sprintf("%O", settings.DefaultDirMode), "mode bits that new directories are created with") + + flags.Uint64("tus.chunkSize", settings.DefaultTusChunkSize, "the tus chunk size") + flags.Uint16("tus.retryCount", settings.DefaultTusRetryCount, "the tus retry count") } func getAuthMethod(flags *pflag.FlagSet, defaults ...interface{}) (settings.AuthMethod, map[string]interface{}, error) { @@ -215,6 +218,9 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut fmt.Fprintf(w, "\tTLS Cert:\t%s\n", ser.TLSCert) fmt.Fprintf(w, "\tTLS Key:\t%s\n", ser.TLSKey) fmt.Fprintf(w, "\tExec Enabled:\t%t\n", ser.EnableExec) + fmt.Fprintln(w, "\nTUS:") + fmt.Fprintf(w, "\tChunk size:\t%d\n", set.Tus.ChunkSize) + fmt.Fprintf(w, "\tRetry count:\t%d\n", set.Tus.RetryCount) fmt.Fprintln(w, "\nDefaults:") fmt.Fprintf(w, "\tScope:\t%s\n", set.Defaults.Scope) fmt.Fprintf(w, "\tHideDotfiles:\t%t\n", set.Defaults.HideDotfiles) diff --git a/filebrowser/cmd/config_init.go b/filebrowser/cmd/config_init.go index 693b6aceb6..47d02d8aeb 100644 --- a/filebrowser/cmd/config_init.go +++ b/filebrowser/cmd/config_init.go @@ -86,6 +86,16 @@ override the options.`, return err } + tusChunkSize, err := flags.GetUint64("tus.chunkSize") + if err != nil { + return err + } + + tusRetryCount, err := flags.GetUint16("tus.retryCount") + if err != nil { + return err + } + s := &settings.Settings{ Key: key, Signup: signup, @@ -102,6 +112,10 @@ override the options.`, Theme: brandingTheme, Files: brandingFiles, }, + Tus: settings.Tus{ + ChunkSize: tusChunkSize, + RetryCount: tusRetryCount, + }, } s.FileMode, err = getMode(flags, "file-mode") diff --git a/filebrowser/cmd/config_set.go b/filebrowser/cmd/config_set.go index 255ef47028..c362e2e10e 100644 --- a/filebrowser/cmd/config_set.go +++ b/filebrowser/cmd/config_set.go @@ -80,6 +80,10 @@ you want to change. Other options will remain unchanged.`, set.FileMode, err = getMode(flags, flag.Name) case "dir-mode": set.DirMode, err = getMode(flags, flag.Name) + case "tus.chunkSize": + set.Tus.ChunkSize, err = flags.GetUint64(flag.Name) + case "tus.retryCount": + set.Tus.RetryCount, err = flags.GetUint16(flag.Name) } }) diff --git a/filebrowser/cmd/docs.go b/filebrowser/cmd/docs.go index 90e5a25977..7f4f536ede 100644 --- a/filebrowser/cmd/docs.go +++ b/filebrowser/cmd/docs.go @@ -3,36 +3,18 @@ package cmd import ( "bytes" "fmt" - "io" "os" - "path/filepath" - "sort" + "path" + "regexp" "strings" "github.com/spf13/cobra" - "github.com/spf13/pflag" + "github.com/spf13/cobra/doc" ) func init() { rootCmd.AddCommand(docsCmd) - docsCmd.Flags().StringP("path", "p", "./docs", "path to save the docs") -} - -func printToc(names []string) { - for i, name := range names { - name = strings.TrimSuffix(name, filepath.Ext(name)) - name = strings.ReplaceAll(name, "-", " ") - names[i] = name - } - - sort.Strings(names) - - toc := "" - for _, name := range names { - toc += "* [" + name + "](cli/" + strings.ReplaceAll(name, " ", "-") + ".md)\n" - } - - fmt.Println(toc) + docsCmd.Flags().String("out", "www/docs/cli", "directory to write the docs to") } var docsCmd = &cobra.Command{ @@ -40,115 +22,61 @@ var docsCmd = &cobra.Command{ Hidden: true, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { - dir, err := getString(cmd.Flags(), "path") + outputDir, err := cmd.Flags().GetString("out") if err != nil { return err } - err = generateDocs(rootCmd, dir) + tempDir, err := os.MkdirTemp(os.TempDir(), "filebrowser-docs-") if err != nil { return err } - names := []string{} + defer os.RemoveAll(tempDir) - err = filepath.Walk(dir, func(_ string, info os.FileInfo, err error) error { - if err != nil || info.IsDir() { - return err - } + rootCmd.Root().DisableAutoGenTag = true - if !strings.HasPrefix(info.Name(), "filebrowser") { - return nil - } - - names = append(names, info.Name()) - return nil + err = doc.GenMarkdownTreeCustom(cmd.Root(), tempDir, func(f string) string { + return "" + }, func(s string) string { + return s }) if err != nil { return err } - printToc(names) - return nil - }, -} - -func generateDocs(cmd *cobra.Command, dir string) error { - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - - err := generateDocs(c, dir) + entries, err := os.ReadDir(tempDir) if err != nil { return err } - } - basename := strings.ReplaceAll(cmd.CommandPath(), " ", "-") + ".md" - filename := filepath.Join(dir, basename) - f, err := os.Create(filename) - if err != nil { - return err - } - defer f.Close() - return generateMarkdown(cmd, f) -} - -func generateMarkdown(cmd *cobra.Command, w io.Writer) error { - cmd.InitDefaultHelpCmd() - cmd.InitDefaultHelpFlag() - - buf := new(bytes.Buffer) - name := cmd.CommandPath() - - short := cmd.Short - long := cmd.Long - if long == "" { - long = short - } - - buf.WriteString("---\ndescription: " + short + "\n---\n\n") - buf.WriteString("# " + name + "\n\n") - buf.WriteString("## Synopsis\n\n") - buf.WriteString(long + "\n\n") - - if cmd.Runnable() { - _, _ = fmt.Fprintf(buf, "```\n%s\n```\n\n", cmd.UseLine()) - } - - if cmd.Example != "" { - buf.WriteString("## Examples\n\n") - _, _ = fmt.Fprintf(buf, "```\n%s\n```\n\n", cmd.Example) - } - - printOptions(buf, cmd) - _, err := buf.WriteTo(w) - return err -} - -func generateFlagsTable(fs *pflag.FlagSet, buf io.StringWriter) { - _, _ = buf.WriteString("| Name | Shorthand | Usage |\n") - _, _ = buf.WriteString("|------|-----------|-------|\n") - - fs.VisitAll(func(f *pflag.Flag) { - _, _ = buf.WriteString("|" + f.Name + "|" + f.Shorthand + "|" + f.Usage + "|\n") - }) -} - -func printOptions(buf *bytes.Buffer, cmd *cobra.Command) { - flags := cmd.NonInheritedFlags() - flags.SetOutput(buf) - if flags.HasAvailableFlags() { - buf.WriteString("## Options\n\n") - generateFlagsTable(flags, buf) - buf.WriteString("\n") - } - - parentFlags := cmd.InheritedFlags() - parentFlags.SetOutput(buf) - if parentFlags.HasAvailableFlags() { - buf.WriteString("### Inherited\n\n") - generateFlagsTable(parentFlags, buf) - buf.WriteString("\n") - } + headerRegex := regexp.MustCompile(`(?m)^(##)(.*)$`) + linkRegex := regexp.MustCompile(`\(filebrowser(.*)\.md\)`) + + fmt.Println("Generated Documents:") + + for _, entry := range entries { + srcPath := path.Join(tempDir, entry.Name()) + dstPath := path.Join(outputDir, strings.ReplaceAll(entry.Name(), "_", "-")) + + data, err := os.ReadFile(srcPath) + if err != nil { + return err + } + + data = headerRegex.ReplaceAll(data, []byte("#$2")) + data = linkRegex.ReplaceAllFunc(data, func(b []byte) []byte { + return bytes.ReplaceAll(b, []byte("_"), []byte("-")) + }) + data = bytes.ReplaceAll(data, []byte("## SEE ALSO"), []byte("## See Also")) + + err = os.WriteFile(dstPath, data, 0666) + if err != nil { + return err + } + + fmt.Println("- " + dstPath) + } + + return nil + }, } diff --git a/filebrowser/cmd/root.go b/filebrowser/cmd/root.go index 24f5d07727..0d103b2985 100644 --- a/filebrowser/cmd/root.go +++ b/filebrowser/cmd/root.go @@ -26,7 +26,6 @@ import ( "github.com/filebrowser/filebrowser/v2/auth" "github.com/filebrowser/filebrowser/v2/diskcache" - fbErrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/frontend" fbhttp "github.com/filebrowser/filebrowser/v2/http" "github.com/filebrowser/filebrowser/v2/img" @@ -241,18 +240,7 @@ user created with the credentials from options "username" and "password".`, } log.Println("Graceful shutdown complete.") - switch sig { - case syscall.SIGHUP: - d.err = fbErrors.ErrSighup - case syscall.SIGINT: - d.err = fbErrors.ErrSigint - case syscall.SIGQUIT: - d.err = fbErrors.ErrSigquit - case syscall.SIGTERM: - d.err = fbErrors.ErrSigTerm - } - - return d.err + return nil }, pythonConfig{allowNoDB: true}), } diff --git a/filebrowser/cmd/upgrade.go b/filebrowser/cmd/upgrade.go deleted file mode 100644 index 7142b1512c..0000000000 --- a/filebrowser/cmd/upgrade.go +++ /dev/null @@ -1,40 +0,0 @@ -package cmd - -import ( - "github.com/spf13/cobra" - - "github.com/filebrowser/filebrowser/v2/storage/bolt/importer" -) - -func init() { - rootCmd.AddCommand(upgradeCmd) - - upgradeCmd.Flags().String("old.database", "", "") - upgradeCmd.Flags().String("old.config", "", "") - _ = upgradeCmd.MarkFlagRequired("old.database") -} - -var upgradeCmd = &cobra.Command{ - Use: "upgrade", - Short: "Upgrades an old configuration", - Long: `Upgrades an old configuration. This command DOES NOT -import share links because they are incompatible with -this version.`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - flags := cmd.Flags() - oldDB, err := getString(flags, "old.database") - if err != nil { - return err - } - oldConf, err := getString(flags, "old.config") - if err != nil { - return err - } - db, err := getString(flags, "database") - if err != nil { - return err - } - return importer.Import(oldDB, oldConf, db) - }, -} diff --git a/filebrowser/cmd/utils.go b/filebrowser/cmd/utils.go index cc71834109..3ed5c989f2 100644 --- a/filebrowser/cmd/utils.go +++ b/filebrowser/cmd/utils.go @@ -66,7 +66,6 @@ type pythonConfig struct { type pythonData struct { hadDB bool store *storage.Storage - err error } func dbExists(path string) (bool, error) { diff --git a/filebrowser/errors/errors.go b/filebrowser/errors/errors.go index f8abee59d6..5fd760c212 100644 --- a/filebrowser/errors/errors.go +++ b/filebrowser/errors/errors.go @@ -3,15 +3,6 @@ package errors import ( "errors" "fmt" - "os" - "syscall" -) - -const ( - ExitCodeSigTerm = 128 + int(syscall.SIGTERM) - ExitCodeSighup = 128 + int(syscall.SIGHUP) - ExitCodeSigint = 128 + int(syscall.SIGINT) - ExitCodeSigquit = 128 + int(syscall.SIGQUIT) ) var ( @@ -31,10 +22,6 @@ var ( ErrInvalidRequestParams = errors.New("invalid request params") ErrSourceIsParent = errors.New("source is parent") ErrRootUserDeletion = errors.New("user with id 1 can't be deleted") - ErrSigTerm = errors.New("exit on signal: sigterm") - ErrSighup = errors.New("exit on signal: sighup") - ErrSigint = errors.New("exit on signal: sigint") - ErrSigquit = errors.New("exit on signal: sigquit") ) type ErrShortPassword struct { @@ -44,44 +31,3 @@ type ErrShortPassword struct { func (e ErrShortPassword) Error() string { return fmt.Sprintf("password is too short, minimum length is %d", e.MinimumLength) } - -// GetExitCode returns the exit code for a given error. -func GetExitCode(err error) int { - if err == nil { - return 0 - } - - exitCodeMap := map[error]int{ - ErrSigTerm: ExitCodeSigTerm, - ErrSighup: ExitCodeSighup, - ErrSigint: ExitCodeSigint, - ErrSigquit: ExitCodeSigquit, - } - - for e, code := range exitCodeMap { - if errors.Is(err, e) { - return code - } - } - - if exitErr, ok := err.(interface{ ExitCode() int }); ok { - return exitErr.ExitCode() - } - - var pathErr *os.PathError - if errors.As(err, &pathErr) { - return 1 - } - - var syscallErr *os.SyscallError - if errors.As(err, &syscallErr) { - return 1 - } - - var errno syscall.Errno - if errors.As(err, &errno) { - return 1 - } - - return 1 -} diff --git a/filebrowser/frontend/pnpm-lock.yaml b/filebrowser/frontend/pnpm-lock.yaml index 4f4907ee5c..db9de50515 100644 --- a/filebrowser/frontend/pnpm-lock.yaml +++ b/filebrowser/frontend/pnpm-lock.yaml @@ -161,7 +161,7 @@ importers: version: 2.3.1(rollup@4.52.5) vue-tsc: specifier: ^3.1.3 - version: 3.1.3(typescript@5.9.3) + version: 3.1.4(typescript@5.9.3) packages: @@ -1303,8 +1303,8 @@ packages: typescript: optional: true - '@vue/language-core@3.1.3': - resolution: {integrity: sha512-KpR1F/eGAG9D1RZ0/T6zWJs6dh/pRLfY5WupecyYKJ1fjVmDMgTPw9wXmKv2rBjo4zCJiOSiyB8BDP1OUwpMEA==} + '@vue/language-core@3.1.4': + resolution: {integrity: sha512-n/58wm8SkmoxMWkUNUH/PwoovWe4hmdyPJU2ouldr3EPi1MLoS7iDN46je8CsP95SnVBs2axInzRglPNKvqMcg==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -2484,8 +2484,8 @@ packages: peerDependencies: vue: ^3.0.2 - vue-tsc@3.1.3: - resolution: {integrity: sha512-StMNfZHwPIXQgY3KxPKM0Jsoc8b46mDV3Fn2UlHCBIwRJApjqrSwqeMYgWf0zpN+g857y74pv7GWuBm+UqQe1w==} + vue-tsc@3.1.4: + resolution: {integrity: sha512-GsRJxttj4WkmXW/zDwYPGMJAN3np/4jTzoDFQTpTsI5Vg/JKMWamBwamlmLihgSVHO66y9P7GX+uoliYxeI4Hw==} hasBin: true peerDependencies: typescript: '>=5.0.0' @@ -3828,7 +3828,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@vue/language-core@3.1.3(typescript@5.9.3)': + '@vue/language-core@3.1.4(typescript@5.9.3)': dependencies: '@volar/language-core': 2.4.23 '@vue/compiler-dom': 3.5.24 @@ -4966,10 +4966,10 @@ snapshots: dependencies: vue: 3.5.24(typescript@5.9.3) - vue-tsc@3.1.3(typescript@5.9.3): + vue-tsc@3.1.4(typescript@5.9.3): dependencies: '@volar/typescript': 2.4.23 - '@vue/language-core': 3.1.3(typescript@5.9.3) + '@vue/language-core': 3.1.4(typescript@5.9.3) typescript: 5.9.3 vue@3.5.24(typescript@5.9.3): diff --git a/filebrowser/go.mod b/filebrowser/go.mod index 7736fe11bf..47da261994 100644 --- a/filebrowser/go.mod +++ b/filebrowser/go.mod @@ -16,7 +16,6 @@ require ( github.com/marusama/semaphore/v2 v2.5.0 github.com/mholt/archives v0.1.5 github.com/mitchellh/go-homedir v1.1.0 - github.com/pelletier/go-toml/v2 v2.2.4 github.com/shirou/gopsutil/v4 v4.25.10 github.com/spf13/afero v1.15.0 github.com/spf13/cobra v1.10.1 @@ -24,7 +23,6 @@ require ( github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce - go.etcd.io/bbolt v1.4.3 golang.org/x/crypto v0.44.0 golang.org/x/image v0.33.0 golang.org/x/text v0.31.0 @@ -40,6 +38,7 @@ require ( github.com/bodgit/plumbing v1.3.0 // indirect github.com/bodgit/sevenzip v1.6.1 // indirect github.com/bodgit/windows v1.0.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect @@ -58,9 +57,11 @@ require ( github.com/mikelolasagasti/xz v1.0.1 // indirect github.com/minio/minlz v1.0.1 // indirect github.com/nwaples/rardecode/v2 v2.2.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sorairolake/lzip-go v0.3.8 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect @@ -68,6 +69,7 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/ulikunitz/xz v0.5.15 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.etcd.io/bbolt v1.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/net v0.46.0 // indirect diff --git a/filebrowser/go.sum b/filebrowser/go.sum index 0b37400712..c6b0e41bcc 100644 --- a/filebrowser/go.sum +++ b/filebrowser/go.sum @@ -47,6 +47,7 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -196,6 +197,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= diff --git a/filebrowser/main.go b/filebrowser/main.go index d17550c901..bde39461f5 100644 --- a/filebrowser/main.go +++ b/filebrowser/main.go @@ -4,11 +4,10 @@ import ( "os" "github.com/filebrowser/filebrowser/v2/cmd" - "github.com/filebrowser/filebrowser/v2/errors" ) func main() { if err := cmd.Execute(); err != nil { - os.Exit(errors.GetExitCode(err)) + os.Exit(1) } } diff --git a/filebrowser/storage/bolt/importer/conf.go b/filebrowser/storage/bolt/importer/conf.go deleted file mode 100644 index b3ac0ba7d0..0000000000 --- a/filebrowser/storage/bolt/importer/conf.go +++ /dev/null @@ -1,187 +0,0 @@ -package importer - -import ( - "encoding/json" - "errors" - "fmt" - "os" - "path/filepath" - - "github.com/asdine/storm/v3" - "github.com/pelletier/go-toml/v2" - "gopkg.in/yaml.v3" - - "github.com/filebrowser/filebrowser/v2/auth" - "github.com/filebrowser/filebrowser/v2/settings" - "github.com/filebrowser/filebrowser/v2/storage" - "github.com/filebrowser/filebrowser/v2/users" -) - -type oldDefs struct { - Commands []string `json:"commands" yaml:"commands" toml:"commands"` - Scope string `json:"scope" yaml:"scope" toml:"scope"` - ViewMode string `json:"viewMode" yaml:"viewMode" toml:"viewMode"` - Locale string `json:"locale" yaml:"locale" toml:"locale"` - AllowCommands bool `json:"allowCommands" yaml:"allowCommands" toml:"allowCommands"` - AllowEdit bool `json:"allowEdit" yaml:"allowEdit" toml:"allowEdit"` - AllowNew bool `json:"allowNew" yaml:"allowNew" toml:"allowNew"` -} - -type oldAuth struct { - Method string `json:"method" yaml:"method" toml:"method"` // default none proxy - Header string `json:"header" yaml:"header" toml:"header"` - Command string `json:"command" yaml:"command" toml:"command"` -} - -type oldConf struct { - Port string `json:"port" yaml:"port" toml:"port"` - BaseURL string `json:"baseURL" yaml:"baseURL" toml:"baseURL"` - Log string `json:"log" yaml:"log" toml:"log"` - Address string `json:"address" yaml:"address" toml:"address"` - Defaults oldDefs `json:"defaults" yaml:"defaults" toml:"defaults"` - ReCaptcha struct { - Key string `json:"key" yaml:"key" toml:"key"` - Secret string `json:"secret" yaml:"secret" toml:"secret"` - Host string `json:"host" yaml:"host" toml:"host"` - } `json:"recaptcha" yaml:"recaptcha" toml:"recaptcha"` - Auth oldAuth `json:"auth" yaml:"auth" toml:"auth"` -} - -var defaults = &oldConf{ - Port: "0", - Log: "stdout", - Defaults: oldDefs{ - Commands: []string{"git", "svn", "hg"}, - ViewMode: string(users.MosaicViewMode), - AllowCommands: true, - AllowEdit: true, - AllowNew: true, - Locale: "en", - }, - Auth: oldAuth{ - Method: "default", - }, -} - -func readConf(path string) (*oldConf, error) { - cfg := &oldConf{} - if path != "" { - ext := filepath.Ext(path) - - fd, err := os.Open(path) - if err != nil { - return nil, err - } - defer fd.Close() - - switch ext { - case ".json": - err = json.NewDecoder(fd).Decode(cfg) - case ".toml": - err = toml.NewDecoder(fd).Decode(cfg) - case ".yaml", ".yml": - err = yaml.NewDecoder(fd).Decode(cfg) - default: - return nil, errors.New("unsupported config extension " + ext) - } - - if err != nil { - return nil, err - } - } else { - cfg = defaults - path, err := filepath.Abs(".") - if err != nil { - return nil, err - } - cfg.Defaults.Scope = path - } - return cfg, nil -} - -func importConf(db *storm.DB, path string, sto *storage.Storage) error { - cfg, err := readConf(path) - if err != nil { - return err - } - - commands := map[string][]string{} - err = db.Get("config", "commands", &commands) - if err != nil { - return err - } - - key := []byte{} - err = db.Get("config", "key", &key) - if err != nil { - return err - } - - s := &settings.Settings{ - Key: key, - Signup: false, - Defaults: settings.UserDefaults{ - Scope: cfg.Defaults.Scope, - Commands: cfg.Defaults.Commands, - ViewMode: users.ViewMode(cfg.Defaults.ViewMode), - Locale: cfg.Defaults.Locale, - Perm: users.Permissions{ - Admin: false, - Execute: cfg.Defaults.AllowCommands, - Create: cfg.Defaults.AllowNew, - Rename: cfg.Defaults.AllowEdit, - Modify: cfg.Defaults.AllowEdit, - Delete: cfg.Defaults.AllowEdit, - Share: true, - Download: true, - }, - }, - } - - server := &settings.Server{ - BaseURL: cfg.BaseURL, - Port: cfg.Port, - Address: cfg.Address, - Log: cfg.Log, - } - - var auther auth.Auther - switch cfg.Auth.Method { - case "proxy": - auther = &auth.ProxyAuth{Header: cfg.Auth.Header} - s.AuthMethod = auth.MethodProxyAuth - case "hook": - auther = &auth.HookAuth{Command: cfg.Auth.Command} - s.AuthMethod = auth.MethodHookAuth - case "none": - auther = &auth.NoAuth{} - s.AuthMethod = auth.MethodNoAuth - default: - auther = &auth.JSONAuth{ - ReCaptcha: &auth.ReCaptcha{ - Host: cfg.ReCaptcha.Host, - Key: cfg.ReCaptcha.Key, - Secret: cfg.ReCaptcha.Secret, - }, - } - s.AuthMethod = auth.MethodJSONAuth - } - - err = sto.Auth.Save(auther) - if err != nil { - return err - } - - err = sto.Settings.Save(s) - if err != nil { - return err - } - - err = sto.Settings.SaveServer(server) - if err != nil { - return err - } - - fmt.Println("Configuration successfully imported.") - return nil -} diff --git a/filebrowser/storage/bolt/importer/importer.go b/filebrowser/storage/bolt/importer/importer.go deleted file mode 100644 index 9c7377569f..0000000000 --- a/filebrowser/storage/bolt/importer/importer.go +++ /dev/null @@ -1,39 +0,0 @@ -package importer - -import ( - "github.com/asdine/storm/v3" - - "github.com/filebrowser/filebrowser/v2/storage/bolt" -) - -// Import imports an old configuration to a newer database. -func Import(oldDBPath, oldConf, newDBPath string) error { - oldDB, err := storm.Open(oldDBPath) - if err != nil { - return err - } - defer oldDB.Close() - - newDB, err := storm.Open(newDBPath) - if err != nil { - return err - } - defer newDB.Close() - - sto, err := bolt.NewStorage(newDB) - if err != nil { - return err - } - - err = importUsers(oldDB, sto) - if err != nil { - return err - } - - err = importConf(oldDB, oldConf, sto) - if err != nil { - return err - } - - return err -} diff --git a/filebrowser/storage/bolt/importer/users.go b/filebrowser/storage/bolt/importer/users.go deleted file mode 100644 index 1b44214762..0000000000 --- a/filebrowser/storage/bolt/importer/users.go +++ /dev/null @@ -1,114 +0,0 @@ -package importer - -import ( - "encoding/json" - "fmt" - - "github.com/asdine/storm/v3" - bolt "go.etcd.io/bbolt" - - "github.com/filebrowser/filebrowser/v2/rules" - "github.com/filebrowser/filebrowser/v2/storage" - "github.com/filebrowser/filebrowser/v2/users" -) - -type oldUser struct { - ID int `storm:"id,increment"` - Admin bool `json:"admin"` - AllowCommands bool `json:"allowCommands"` // Execute commands - AllowEdit bool `json:"allowEdit"` // Edit/rename files - AllowNew bool `json:"allowNew"` // Create files and folders - AllowPublish bool `json:"allowPublish"` // Publish content (to use with static gen) - LockPassword bool `json:"lockPassword"` - Commands []string `json:"commands"` - Locale string `json:"locale"` - Password string `json:"password"` - Rules []*rules.Rule `json:"rules"` - Scope string `json:"filesystem"` - Username string `json:"username" storm:"index,unique"` - ViewMode string `json:"viewMode"` -} - -func readOldUsers(db *storm.DB) ([]*oldUser, error) { - var oldUsers []*oldUser - err := db.Bolt.View(func(tx *bolt.Tx) error { - return tx.Bucket([]byte("User")).ForEach(func(_ []byte, v []byte) error { - if len(v) > 0 && string(v)[0] == '{' { - user := &oldUser{} - err := json.Unmarshal(v, user) - - if err != nil { - return err - } - - oldUsers = append(oldUsers, user) - } - - return nil - }) - }) - - return oldUsers, err -} - -func convertUsersToNew(old []*oldUser) ([]*users.User, error) { - list := []*users.User{} - - for _, oldUser := range old { - user := &users.User{ - Username: oldUser.Username, - Password: oldUser.Password, - Scope: oldUser.Scope, - Locale: oldUser.Locale, - LockPassword: oldUser.LockPassword, - ViewMode: users.ViewMode(oldUser.ViewMode), - Commands: oldUser.Commands, - Rules: []rules.Rule{}, - Perm: users.Permissions{ - Admin: oldUser.Admin, - Execute: oldUser.AllowCommands, - Create: oldUser.AllowNew, - Rename: oldUser.AllowEdit, - Modify: oldUser.AllowEdit, - Delete: oldUser.AllowEdit, - Share: true, - Download: true, - }, - } - - for _, rule := range oldUser.Rules { - user.Rules = append(user.Rules, *rule) - } - - err := user.Clean("") - if err != nil { - return nil, err - } - - list = append(list, user) - } - - return list, nil -} - -func importUsers(old *storm.DB, sto *storage.Storage) error { - oldUsers, err := readOldUsers(old) - if err != nil { - return err - } - - newUsers, err := convertUsersToNew(oldUsers) - if err != nil { - return err - } - - for _, user := range newUsers { - err = sto.Users.Save(user) - if err != nil { - return err - } - } - - fmt.Printf("%d users successfully imported into the new DB.\n", len(newUsers)) - return nil -} diff --git a/filebrowser/www/docs/authentication.md b/filebrowser/www/docs/authentication.md new file mode 100644 index 0000000000..365f9dacfa --- /dev/null +++ b/filebrowser/www/docs/authentication.md @@ -0,0 +1,49 @@ +# Authentication + +There are three possible authentication methods. Each one of them has its own capabilities and specification. If you are interested in contributing with one more authentication method, please [check the guidelines](contributing.md). + +## JSON Auth (default) + +We call it JSON Authentication but it is just the default authentication method and the one that is provided by default if you don't make any changes. It is set by default, but if you've made changes before you can revert to using JSON auth: + +```sh +filebrowser config set --auth.method=json +``` + +This method can also be extended with **reCAPTCHA** verification during login: + +```sh +filebrowser config set --auth.method=json \ + --recaptcha.key site-key \ + --recaptcha.secret private-key +``` + +By default, we use [Google's reCAPTCHA](https://developers.google.com/recaptcha/docs/display) service. If you live in China, or want to use other provider, you can change the host with the following command: + +```sh +filebrowser config set --recaptcha.host https://recaptcha.net +``` + +Where `https://recaptcha.net` is any provider you want. + +## Proxy Header + +If you have a reverse proxy you want to use to login your users, you do it via our `proxy` authentication method. To configure this method, your proxy must send an HTTP header containing the username of the logged in user: + +```sh +filebrowser config set --auth.method=proxy --auth.header=X-My-Header +``` + +Where `X-My-Header` is the HTTP header provided by your proxy with the username. + +> [!WARNING] +> +> File Browser will blindly trust the provided header. If the proxy can be bypassed, an attacker could simply attach the header and get admin access. + +### No Authentication + +We also provide a no authentication mechanism for users that want to use File Browser privately such in a home network. By setting this authentication method, the user with **id 1** will be used as the default users. Creating more users won't have any effect. + +```sh +filebrowser config set --auth.method=noauth +``` diff --git a/filebrowser/www/docs/cli/filebrowser-cmds-add.md b/filebrowser/www/docs/cli/filebrowser-cmds-add.md new file mode 100644 index 0000000000..fc064ea9b1 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-cmds-add.md @@ -0,0 +1,29 @@ +# filebrowser cmds add + +Add a command to run on a specific event + +## Synopsis + +Add a command to run on a specific event. + +``` +filebrowser cmds add [flags] +``` + +## Options + +``` + -h, --help help for add +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser cmds](filebrowser-cmds.md) - Command runner management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-cmds-ls.md b/filebrowser/www/docs/cli/filebrowser-cmds-ls.md new file mode 100644 index 0000000000..136df2e898 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-cmds-ls.md @@ -0,0 +1,30 @@ +# filebrowser cmds ls + +List all commands for each event + +## Synopsis + +List all commands for each event. + +``` +filebrowser cmds ls [flags] +``` + +## Options + +``` + -e, --event string event name, without 'before' or 'after' + -h, --help help for ls +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser cmds](filebrowser-cmds.md) - Command runner management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-cmds-rm.md b/filebrowser/www/docs/cli/filebrowser-cmds-rm.md new file mode 100644 index 0000000000..837813b998 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-cmds-rm.md @@ -0,0 +1,37 @@ +# filebrowser cmds rm + +Removes a command from an event hooker + +## Synopsis + +Removes a command from an event hooker. The provided index +is the same that's printed when you run 'cmds ls'. Note +that after each removal/addition, the index of the +commands change. So be careful when removing them after each +other. + +You can also specify an optional parameter (index_end) so +you can remove all commands from 'index' to 'index_end', +including 'index_end'. + +``` +filebrowser cmds rm [index_end] [flags] +``` + +## Options + +``` + -h, --help help for rm +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser cmds](filebrowser-cmds.md) - Command runner management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-cmds.md b/filebrowser/www/docs/cli/filebrowser-cmds.md new file mode 100644 index 0000000000..bc61418b1d --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-cmds.md @@ -0,0 +1,28 @@ +# filebrowser cmds + +Command runner management utility + +## Synopsis + +Command runner management utility. + +## Options + +``` + -h, --help help for cmds +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser +* [filebrowser cmds add](filebrowser-cmds-add.md) - Add a command to run on a specific event +* [filebrowser cmds ls](filebrowser-cmds-ls.md) - List all commands for each event +* [filebrowser cmds rm](filebrowser-cmds-rm.md) - Removes a command from an event hooker + diff --git a/filebrowser/www/docs/cli/filebrowser-completion-bash.md b/filebrowser/www/docs/cli/filebrowser-completion-bash.md new file mode 100644 index 0000000000..e4c8963a53 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-completion-bash.md @@ -0,0 +1,50 @@ +# filebrowser completion bash + +Generate the autocompletion script for bash + +## Synopsis + +Generate the autocompletion script for the bash shell. + +This script depends on the 'bash-completion' package. +If it is not installed already, you can install it via your OS's package manager. + +To load completions in your current shell session: + + source <(filebrowser completion bash) + +To load completions for every new session, execute once: + +### Linux: + + filebrowser completion bash > /etc/bash_completion.d/filebrowser + +### macOS: + + filebrowser completion bash > $(brew --prefix)/etc/bash_completion.d/filebrowser + +You will need to start a new shell for this setup to take effect. + + +``` +filebrowser completion bash +``` + +## Options + +``` + -h, --help help for bash + --no-descriptions disable completion descriptions +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell + diff --git a/filebrowser/www/docs/cli/filebrowser-completion-fish.md b/filebrowser/www/docs/cli/filebrowser-completion-fish.md new file mode 100644 index 0000000000..e8297aa199 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-completion-fish.md @@ -0,0 +1,41 @@ +# filebrowser completion fish + +Generate the autocompletion script for fish + +## Synopsis + +Generate the autocompletion script for the fish shell. + +To load completions in your current shell session: + + filebrowser completion fish | source + +To load completions for every new session, execute once: + + filebrowser completion fish > ~/.config/fish/completions/filebrowser.fish + +You will need to start a new shell for this setup to take effect. + + +``` +filebrowser completion fish [flags] +``` + +## Options + +``` + -h, --help help for fish + --no-descriptions disable completion descriptions +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell + diff --git a/filebrowser/www/docs/cli/filebrowser-completion-powershell.md b/filebrowser/www/docs/cli/filebrowser-completion-powershell.md new file mode 100644 index 0000000000..21f84c4c6c --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-completion-powershell.md @@ -0,0 +1,38 @@ +# filebrowser completion powershell + +Generate the autocompletion script for powershell + +## Synopsis + +Generate the autocompletion script for powershell. + +To load completions in your current shell session: + + filebrowser completion powershell | Out-String | Invoke-Expression + +To load completions for every new session, add the output of the above command +to your powershell profile. + + +``` +filebrowser completion powershell [flags] +``` + +## Options + +``` + -h, --help help for powershell + --no-descriptions disable completion descriptions +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell + diff --git a/filebrowser/www/docs/cli/filebrowser-completion-zsh.md b/filebrowser/www/docs/cli/filebrowser-completion-zsh.md new file mode 100644 index 0000000000..f54794b07d --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-completion-zsh.md @@ -0,0 +1,52 @@ +# filebrowser completion zsh + +Generate the autocompletion script for zsh + +## Synopsis + +Generate the autocompletion script for the zsh shell. + +If shell completion is not already enabled in your environment you will need +to enable it. You can execute the following once: + + echo "autoload -U compinit; compinit" >> ~/.zshrc + +To load completions in your current shell session: + + source <(filebrowser completion zsh) + +To load completions for every new session, execute once: + +### Linux: + + filebrowser completion zsh > "${fpath[1]}/_filebrowser" + +### macOS: + + filebrowser completion zsh > $(brew --prefix)/share/zsh/site-functions/_filebrowser + +You will need to start a new shell for this setup to take effect. + + +``` +filebrowser completion zsh [flags] +``` + +## Options + +``` + -h, --help help for zsh + --no-descriptions disable completion descriptions +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell + diff --git a/filebrowser/www/docs/cli/filebrowser-completion.md b/filebrowser/www/docs/cli/filebrowser-completion.md new file mode 100644 index 0000000000..b2c6bdc1b3 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-completion.md @@ -0,0 +1,31 @@ +# filebrowser completion + +Generate the autocompletion script for the specified shell + +## Synopsis + +Generate the autocompletion script for filebrowser for the specified shell. +See each sub-command's help for details on how to use the generated script. + + +## Options + +``` + -h, --help help for completion +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser +* [filebrowser completion bash](filebrowser-completion-bash.md) - Generate the autocompletion script for bash +* [filebrowser completion fish](filebrowser-completion-fish.md) - Generate the autocompletion script for fish +* [filebrowser completion powershell](filebrowser-completion-powershell.md) - Generate the autocompletion script for powershell +* [filebrowser completion zsh](filebrowser-completion-zsh.md) - Generate the autocompletion script for zsh + diff --git a/filebrowser/www/docs/cli/filebrowser-config-cat.md b/filebrowser/www/docs/cli/filebrowser-config-cat.md new file mode 100644 index 0000000000..952580fdb3 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config-cat.md @@ -0,0 +1,29 @@ +# filebrowser config cat + +Prints the configuration + +## Synopsis + +Prints the configuration. + +``` +filebrowser config cat [flags] +``` + +## Options + +``` + -h, --help help for cat +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser config](filebrowser-config.md) - Configuration management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-config-export.md b/filebrowser/www/docs/cli/filebrowser-config-export.md new file mode 100644 index 0000000000..141d4e8eb8 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config-export.md @@ -0,0 +1,31 @@ +# filebrowser config export + +Export the configuration to a file + +## Synopsis + +Export the configuration to a file. The path must be for a +json or yaml file. This exported configuration can be changed, +and imported again with 'config import' command. + +``` +filebrowser config export [flags] +``` + +## Options + +``` + -h, --help help for export +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser config](filebrowser-config.md) - Configuration management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-config-import.md b/filebrowser/www/docs/cli/filebrowser-config-import.md new file mode 100644 index 0000000000..871da3415f --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config-import.md @@ -0,0 +1,36 @@ +# filebrowser config import + +Import a configuration file + +## Synopsis + +Import a configuration file. This will replace all the existing +configuration. Can be used with or without unexisting databases. + +If used with a nonexisting database, a key will be generated +automatically. Otherwise the key will be kept the same as in the +database. + +The path must be for a json or yaml file. + +``` +filebrowser config import [flags] +``` + +## Options + +``` + -h, --help help for import +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser config](filebrowser-config.md) - Configuration management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-config-init.md b/filebrowser/www/docs/cli/filebrowser-config-init.md new file mode 100644 index 0000000000..126082d02d --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config-init.md @@ -0,0 +1,89 @@ +# filebrowser config init + +Initialize a new database + +## Synopsis + +Initialize a new database to use with File Browser. All of +this options can be changed in the future with the command +'filebrowser config set'. The user related flags apply +to the defaults when creating new users and you don't +override the options. + +``` +filebrowser config init [flags] +``` + +## Options + +``` + --aceEditorTheme string ace editor's syntax highlighting theme for users + -a, --address string address to listen on (default "127.0.0.1") + --auth.command string command for auth.method=hook + --auth.header string HTTP header for auth.method=proxy + --auth.method string authentication type (default "json") + -b, --baseurl string base url + --branding.color string set the theme color + --branding.disableExternal disable external links such as GitHub links + --branding.disableUsedPercentage disable used disk percentage graph + --branding.files string path to directory with images and custom styles + --branding.name string replace 'File Browser' by this name + --branding.theme string set the theme + --cache-dir string file cache directory (disabled if empty) + -t, --cert string tls certificate + --commands strings a list of the commands a user can execute + --create-user-dir generate user's home directory automatically + --dateFormat use date format (true for absolute time, false for relative) + --dir-mode string mode bits that new directories are created with (default "0o750") + --disable-exec disables Command Runner feature (default true) + --disable-preview-resize disable resize of image previews + --disable-thumbnails disable image thumbnails + --disable-type-detection-by-header disables type detection by reading file headers + --file-mode string mode bits that new files are created with (default "0o640") + -h, --help help for init + --hide-login-button hide login button from public pages + --hideDotfiles hide dotfiles + --img-processors int image processors count (default 4) + -k, --key string tls key + --locale string locale for users (default "en") + --lockPassword lock password + -l, --log string log output (default "stdout") + --minimum-password-length uint minimum password length for new users (default 12) + --perm.admin admin perm for users + --perm.create create perm for users (default true) + --perm.delete delete perm for users (default true) + --perm.download download perm for users (default true) + --perm.execute execute perm for users (default true) + --perm.modify modify perm for users (default true) + --perm.rename rename perm for users (default true) + --perm.share share perm for users (default true) + -p, --port string port to listen on (default "8080") + --recaptcha.host string use another host for ReCAPTCHA. recaptcha.net might be useful in China (default "https://www.google.com") + --recaptcha.key string ReCaptcha site key + --recaptcha.secret string ReCaptcha secret + -r, --root string root to prepend to relative paths (default ".") + --scope string scope for users (default ".") + --shell string shell command to which other commands should be appended + -s, --signup allow users to signup + --singleClick use single clicks only + --socket string socket to listen to (cannot be used with address, port, cert nor key flags) + --socket-perm uint32 unix socket file permissions (default 438) + --sorting.asc sorting by ascending order + --sorting.by string sorting mode (name, size or modified) (default "name") + --token-expiration-time string user session timeout (default "2h") + --tus.chunkSize uint the tus chunk size (default 10485760) + --tus.retryCount uint16 the tus retry count (default 5) + --viewMode string view mode for users (default "list") +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser config](filebrowser-config.md) - Configuration management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-config-set.md b/filebrowser/www/docs/cli/filebrowser-config-set.md new file mode 100644 index 0000000000..8d8ea8f53e --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config-set.md @@ -0,0 +1,86 @@ +# filebrowser config set + +Updates the configuration + +## Synopsis + +Updates the configuration. Set the flags for the options +you want to change. Other options will remain unchanged. + +``` +filebrowser config set [flags] +``` + +## Options + +``` + --aceEditorTheme string ace editor's syntax highlighting theme for users + -a, --address string address to listen on (default "127.0.0.1") + --auth.command string command for auth.method=hook + --auth.header string HTTP header for auth.method=proxy + --auth.method string authentication type (default "json") + -b, --baseurl string base url + --branding.color string set the theme color + --branding.disableExternal disable external links such as GitHub links + --branding.disableUsedPercentage disable used disk percentage graph + --branding.files string path to directory with images and custom styles + --branding.name string replace 'File Browser' by this name + --branding.theme string set the theme + --cache-dir string file cache directory (disabled if empty) + -t, --cert string tls certificate + --commands strings a list of the commands a user can execute + --create-user-dir generate user's home directory automatically + --dateFormat use date format (true for absolute time, false for relative) + --dir-mode string mode bits that new directories are created with (default "0o750") + --disable-exec disables Command Runner feature (default true) + --disable-preview-resize disable resize of image previews + --disable-thumbnails disable image thumbnails + --disable-type-detection-by-header disables type detection by reading file headers + --file-mode string mode bits that new files are created with (default "0o640") + -h, --help help for set + --hide-login-button hide login button from public pages + --hideDotfiles hide dotfiles + --img-processors int image processors count (default 4) + -k, --key string tls key + --locale string locale for users (default "en") + --lockPassword lock password + -l, --log string log output (default "stdout") + --minimum-password-length uint minimum password length for new users (default 12) + --perm.admin admin perm for users + --perm.create create perm for users (default true) + --perm.delete delete perm for users (default true) + --perm.download download perm for users (default true) + --perm.execute execute perm for users (default true) + --perm.modify modify perm for users (default true) + --perm.rename rename perm for users (default true) + --perm.share share perm for users (default true) + -p, --port string port to listen on (default "8080") + --recaptcha.host string use another host for ReCAPTCHA. recaptcha.net might be useful in China (default "https://www.google.com") + --recaptcha.key string ReCaptcha site key + --recaptcha.secret string ReCaptcha secret + -r, --root string root to prepend to relative paths (default ".") + --scope string scope for users (default ".") + --shell string shell command to which other commands should be appended + -s, --signup allow users to signup + --singleClick use single clicks only + --socket string socket to listen to (cannot be used with address, port, cert nor key flags) + --socket-perm uint32 unix socket file permissions (default 438) + --sorting.asc sorting by ascending order + --sorting.by string sorting mode (name, size or modified) (default "name") + --token-expiration-time string user session timeout (default "2h") + --tus.chunkSize uint the tus chunk size (default 10485760) + --tus.retryCount uint16 the tus retry count (default 5) + --viewMode string view mode for users (default "list") +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser config](filebrowser-config.md) - Configuration management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-config.md b/filebrowser/www/docs/cli/filebrowser-config.md new file mode 100644 index 0000000000..b87dbf073e --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-config.md @@ -0,0 +1,30 @@ +# filebrowser config + +Configuration management utility + +## Synopsis + +Configuration management utility. + +## Options + +``` + -h, --help help for config +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser +* [filebrowser config cat](filebrowser-config-cat.md) - Prints the configuration +* [filebrowser config export](filebrowser-config-export.md) - Export the configuration to a file +* [filebrowser config import](filebrowser-config-import.md) - Import a configuration file +* [filebrowser config init](filebrowser-config-init.md) - Initialize a new database +* [filebrowser config set](filebrowser-config-set.md) - Updates the configuration + diff --git a/filebrowser/www/docs/cli/filebrowser-hash.md b/filebrowser/www/docs/cli/filebrowser-hash.md new file mode 100644 index 0000000000..9d48054743 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-hash.md @@ -0,0 +1,29 @@ +# filebrowser hash + +Hashes a password + +## Synopsis + +Hashes a password using bcrypt algorithm. + +``` +filebrowser hash [flags] +``` + +## Options + +``` + -h, --help help for hash +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser + diff --git a/filebrowser/www/docs/cli/filebrowser-rules-add.md b/filebrowser/www/docs/cli/filebrowser-rules-add.md new file mode 100644 index 0000000000..2fd2efaff8 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-rules-add.md @@ -0,0 +1,33 @@ +# filebrowser rules add + +Add a global rule or user rule + +## Synopsis + +Add a global rule or user rule. + +``` +filebrowser rules add [flags] +``` + +## Options + +``` + -a, --allow indicates this is an allow rule + -h, --help help for add + -r, --regex indicates this is a regex rule +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") + -i, --id uint id of user to which the rules apply + -u, --username string username of user to which the rules apply +``` + +## See Also + +* [filebrowser rules](filebrowser-rules.md) - Rules management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-rules-ls.md b/filebrowser/www/docs/cli/filebrowser-rules-ls.md new file mode 100644 index 0000000000..8a9cc6ebe3 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-rules-ls.md @@ -0,0 +1,31 @@ +# filebrowser rules ls + +List global rules or user specific rules + +## Synopsis + +List global rules or user specific rules. + +``` +filebrowser rules ls [flags] +``` + +## Options + +``` + -h, --help help for ls +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") + -i, --id uint id of user to which the rules apply + -u, --username string username of user to which the rules apply +``` + +## See Also + +* [filebrowser rules](filebrowser-rules.md) - Rules management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-rules-rm.md b/filebrowser/www/docs/cli/filebrowser-rules-rm.md new file mode 100644 index 0000000000..1870afbb3b --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-rules-rm.md @@ -0,0 +1,40 @@ +# filebrowser rules rm + +Remove a global rule or user rule + +## Synopsis + +Remove a global rule or user rule. The provided index +is the same that's printed when you run 'rules ls'. Note +that after each removal/addition, the index of the +commands change. So be careful when removing them after each +other. + +You can also specify an optional parameter (index_end) so +you can remove all commands from 'index' to 'index_end', +including 'index_end'. + +``` +filebrowser rules rm [index_end] [flags] +``` + +## Options + +``` + -h, --help help for rm + --index uint index of rule to remove +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") + -i, --id uint id of user to which the rules apply + -u, --username string username of user to which the rules apply +``` + +## See Also + +* [filebrowser rules](filebrowser-rules.md) - Rules management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-rules.md b/filebrowser/www/docs/cli/filebrowser-rules.md new file mode 100644 index 0000000000..cc8386d0b7 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-rules.md @@ -0,0 +1,34 @@ +# filebrowser rules + +Rules management utility + +## Synopsis + +On each subcommand you'll have available at least two flags: +"username" and "id". You must either set only one of them +or none. If you set one of them, the command will apply to +an user, otherwise it will be applied to the global set or +rules. + +## Options + +``` + -h, --help help for rules + -i, --id uint id of user to which the rules apply + -u, --username string username of user to which the rules apply +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser +* [filebrowser rules add](filebrowser-rules-add.md) - Add a global rule or user rule +* [filebrowser rules ls](filebrowser-rules-ls.md) - List global rules or user specific rules +* [filebrowser rules rm](filebrowser-rules-rm.md) - Remove a global rule or user rule + diff --git a/filebrowser/www/docs/cli/filebrowser-users-add.md b/filebrowser/www/docs/cli/filebrowser-users-add.md new file mode 100644 index 0000000000..c6c5b53dba --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-add.md @@ -0,0 +1,48 @@ +# filebrowser users add + +Create a new user + +## Synopsis + +Create a new user and add it to the database. + +``` +filebrowser users add [flags] +``` + +## Options + +``` + --aceEditorTheme string ace editor's syntax highlighting theme for users + --commands strings a list of the commands a user can execute + --dateFormat use date format (true for absolute time, false for relative) + -h, --help help for add + --hideDotfiles hide dotfiles + --locale string locale for users (default "en") + --lockPassword lock password + --perm.admin admin perm for users + --perm.create create perm for users (default true) + --perm.delete delete perm for users (default true) + --perm.download download perm for users (default true) + --perm.execute execute perm for users (default true) + --perm.modify modify perm for users (default true) + --perm.rename rename perm for users (default true) + --perm.share share perm for users (default true) + --scope string scope for users (default ".") + --singleClick use single clicks only + --sorting.asc sorting by ascending order + --sorting.by string sorting mode (name, size or modified) (default "name") + --viewMode string view mode for users (default "list") +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-export.md b/filebrowser/www/docs/cli/filebrowser-users-export.md new file mode 100644 index 0000000000..e513a4534b --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-export.md @@ -0,0 +1,30 @@ +# filebrowser users export + +Export all users to a file. + +## Synopsis + +Export all users to a json or yaml file. Please indicate the +path to the file where you want to write the users. + +``` +filebrowser users export [flags] +``` + +## Options + +``` + -h, --help help for export +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-find.md b/filebrowser/www/docs/cli/filebrowser-users-find.md new file mode 100644 index 0000000000..19ed39249d --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-find.md @@ -0,0 +1,29 @@ +# filebrowser users find + +Find a user by username or id + +## Synopsis + +Find a user by username or id. If no flag is set, all users will be printed. + +``` +filebrowser users find [flags] +``` + +## Options + +``` + -h, --help help for find +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-import.md b/filebrowser/www/docs/cli/filebrowser-users-import.md new file mode 100644 index 0000000000..efc185fcda --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-import.md @@ -0,0 +1,34 @@ +# filebrowser users import + +Import users from a file + +## Synopsis + +Import users from a file. The path must be for a json or yaml +file. You can use this command to import new users to your +installation. For that, just don't place their ID on the files +list or set it to 0. + +``` +filebrowser users import [flags] +``` + +## Options + +``` + -h, --help help for import + --overwrite overwrite users with the same id/username combo + --replace replace the entire user base +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-ls.md b/filebrowser/www/docs/cli/filebrowser-users-ls.md new file mode 100644 index 0000000000..59a4f8fe57 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-ls.md @@ -0,0 +1,25 @@ +# filebrowser users ls + +List all users. + +``` +filebrowser users ls [flags] +``` + +## Options + +``` + -h, --help help for ls +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-rm.md b/filebrowser/www/docs/cli/filebrowser-users-rm.md new file mode 100644 index 0000000000..0e3b3035b1 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-rm.md @@ -0,0 +1,29 @@ +# filebrowser users rm + +Delete a user by username or id + +## Synopsis + +Delete a user by username or id + +``` +filebrowser users rm [flags] +``` + +## Options + +``` + -h, --help help for rm +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users-update.md b/filebrowser/www/docs/cli/filebrowser-users-update.md new file mode 100644 index 0000000000..996bdac79b --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users-update.md @@ -0,0 +1,51 @@ +# filebrowser users update + +Updates an existing user + +## Synopsis + +Updates an existing user. Set the flags for the +options you want to change. + +``` +filebrowser users update [flags] +``` + +## Options + +``` + --aceEditorTheme string ace editor's syntax highlighting theme for users + --commands strings a list of the commands a user can execute + --dateFormat use date format (true for absolute time, false for relative) + -h, --help help for update + --hideDotfiles hide dotfiles + --locale string locale for users (default "en") + --lockPassword lock password + -p, --password string new password + --perm.admin admin perm for users + --perm.create create perm for users (default true) + --perm.delete delete perm for users (default true) + --perm.download download perm for users (default true) + --perm.execute execute perm for users (default true) + --perm.modify modify perm for users (default true) + --perm.rename rename perm for users (default true) + --perm.share share perm for users (default true) + --scope string scope for users (default ".") + --singleClick use single clicks only + --sorting.asc sorting by ascending order + --sorting.by string sorting mode (name, size or modified) (default "name") + -u, --username string new username + --viewMode string view mode for users (default "list") +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser users](filebrowser-users.md) - Users management utility + diff --git a/filebrowser/www/docs/cli/filebrowser-users.md b/filebrowser/www/docs/cli/filebrowser-users.md new file mode 100644 index 0000000000..63d82bc115 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-users.md @@ -0,0 +1,32 @@ +# filebrowser users + +Users management utility + +## Synopsis + +Users management utility. + +## Options + +``` + -h, --help help for users +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser +* [filebrowser users add](filebrowser-users-add.md) - Create a new user +* [filebrowser users export](filebrowser-users-export.md) - Export all users to a file. +* [filebrowser users find](filebrowser-users-find.md) - Find a user by username or id +* [filebrowser users import](filebrowser-users-import.md) - Import users from a file +* [filebrowser users ls](filebrowser-users-ls.md) - List all users. +* [filebrowser users rm](filebrowser-users-rm.md) - Delete a user by username or id +* [filebrowser users update](filebrowser-users-update.md) - Updates an existing user + diff --git a/filebrowser/www/docs/cli/filebrowser-version.md b/filebrowser/www/docs/cli/filebrowser-version.md new file mode 100644 index 0000000000..ec3596c56f --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser-version.md @@ -0,0 +1,25 @@ +# filebrowser version + +Print the version number + +``` +filebrowser version [flags] +``` + +## Options + +``` + -h, --help help for version +``` + +## Options inherited from parent commands + +``` + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") +``` + +## See Also + +* [filebrowser](filebrowser.md) - A stylish web-based file browser + diff --git a/filebrowser/www/docs/cli/filebrowser.md b/filebrowser/www/docs/cli/filebrowser.md new file mode 100644 index 0000000000..a8cbe66929 --- /dev/null +++ b/filebrowser/www/docs/cli/filebrowser.md @@ -0,0 +1,83 @@ +# filebrowser + +A stylish web-based file browser + +## Synopsis + +File Browser CLI lets you create the database to use with File Browser, +manage your users and all the configurations without accessing the +web interface. + +If you've never run File Browser, you'll need to have a database for +it. Don't worry: you don't need to setup a separate database server. +We're using Bolt DB which is a single file database and all managed +by ourselves. + +For this specific command, all the flags you have available (except +"config" for the configuration file), can be given either through +environment variables or configuration files. + +If you don't set "config", it will look for a configuration file called +.filebrowser.{json, toml, yaml, yml} in the following directories: + +- ./ +- $HOME/ +- /etc/filebrowser/ + +The precedence of the configuration values are as follows: + +- flags +- environment variables +- configuration file +- database values +- defaults + +The environment variables are prefixed by "FB_" followed by the option +name in caps. So to set "database" via an env variable, you should +set FB_DATABASE. + +Also, if the database path doesn't exist, File Browser will enter into +the quick setup mode and a new database will be bootstrapped and a new +user created with the credentials from options "username" and "password". + +``` +filebrowser [flags] +``` + +## Options + +``` + -a, --address string address to listen on (default "127.0.0.1") + -b, --baseurl string base url + --cache-dir string file cache directory (disabled if empty) + -t, --cert string tls certificate + -c, --config string config file path + -d, --database string database path (default "./filebrowser.db") + --disable-exec disables Command Runner feature (default true) + --disable-preview-resize disable resize of image previews + --disable-thumbnails disable image thumbnails + --disable-type-detection-by-header disables type detection by reading file headers + -h, --help help for filebrowser + --img-processors int image processors count (default 4) + -k, --key string tls key + -l, --log string log output (default "stdout") + --noauth use the noauth auther when using quick setup + --password string hashed password for the first user when using quick config + -p, --port string port to listen on (default "8080") + -r, --root string root to prepend to relative paths (default ".") + --socket string socket to listen to (cannot be used with address, port, cert nor key flags) + --socket-perm uint32 unix socket file permissions (default 438) + --token-expiration-time string user session timeout (default "2h") + --username string username for the first user when using quick config (default "admin") +``` + +## See Also + +* [filebrowser cmds](filebrowser-cmds.md) - Command runner management utility +* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell +* [filebrowser config](filebrowser-config.md) - Configuration management utility +* [filebrowser hash](filebrowser-hash.md) - Hashes a password +* [filebrowser rules](filebrowser-rules.md) - Rules management utility +* [filebrowser users](filebrowser-users.md) - Users management utility +* [filebrowser version](filebrowser-version.md) - Print the version number + diff --git a/filebrowser/www/docs/command-execution.md b/filebrowser/www/docs/command-execution.md new file mode 100644 index 0000000000..454c67b694 --- /dev/null +++ b/filebrowser/www/docs/command-execution.md @@ -0,0 +1,54 @@ +# Command Execution + +> [!CAUTION] +> +> The **hook runner** and **interactive shell** functionalities have been disabled for all existent and new installations by default from version v2.33.8 and onwards, due to continuous and known security vulnerabilities. You should only use this feature if you are aware of all of the security risks involved. For more up to date information, consult issue [#5199](https://github.com/filebrowser/filebrowser/issues/5199). + +## Hook Runner + +The hook runner is a feature that enables you to execute any shell command you want before or after a certain event. Right now, these are the events: + +* Copy +* Rename +* Upload +* Delete +* Save + +Also, during the execution of the commands set for those hooks, there will be some environment variables available to help you perform your commands: + +* `FILE` with the full absolute path to the changed file. +* `SCOPE` with the path to user's scope. +* `TRIGGER` with the name of the event. +* `USERNAME` with the user's username. +* `DESTINATION` with the absolute path to the destination. Only used for **copy** and **rename.** + +At this moment, you can edit the commands via the command line interface, using the following commands \(please check the flag `--help` to know more about them\): + +```bash +filebrowser cmds add before_copy "echo $FILE" +filebrowser cmds rm before_copy 0 +filebrowser cmds ls +``` + +Or you can use the web interface to manage them via **Settings** → **Global Settings**. + +## Interactive Shell + +Within File Browser you can toggle the shell (`< >` icon at the top right) and this will open a shell command window at the bottom of the screen. This functionality can be turned on using the environment variable `FB_DISABLE_EXEC=false` or the flag `--disable-exec=false`. + +By default no commands are available as the command list is empty. To enable commands these need to either be done on a per-user basis (including for the Admin user). + +You can do this by adding them in Settings > User Management > (edit user) > Commands or to *apply to all new users created from that point forward* they can be set in Settings > Global Settings + +> [!NOTE] +> +> If using a proxy manager then remember to enable websockets support for the File Browser proxy + +> [!NOTE] +> +> If using Docker and you want to add a new command that is not in the base image then you will need to build a custom Docker image using `filebrowser/filebrowser` as a base image. For example to add 7z: +> +> ```docker +> FROM filebrowser/filebrowser +> RUN sudo apt install p7zip-full +> ``` diff --git a/filebrowser/www/docs/configuration.md b/filebrowser/www/docs/configuration.md deleted file mode 100644 index 157a54e80e..0000000000 --- a/filebrowser/www/docs/configuration.md +++ /dev/null @@ -1,158 +0,0 @@ -# Configuration - -Most of the configuration can be understood through the command line interface documentation. To access it, you need to install File Browser and run `filebrowser --help`. In this page, we cover some specific, more complex, topics. - -## Flags as Environment Variables - -In some situations, it is easier to use environment variables instead of flags. For example, if you're using our provided Docker image, it's easier for you to use environment variables to customize the settings instead of flags. - -All flags should be available as environment variables prefixed with `FB_`. For example, the flag `--disable-thumbnails` is available as `FB_DISABLE_THUMBNAILS`. - -## Custom Branding - -You can customize File Browser to use your own branding. This includes the following: - -- **Name**: the name of the instance that shows up on the tab title, login pages, and some other places. -- **Disable External Links**: disables all external links, except to the documentation. -- **Disable Used Percentage**: disables the disk usage information on the sidebar. -- **Branding Folder**: directory which can contain two items: - - `custom.css`, containing a global stylesheet to apply to all users. - - `img`, a directory which can replace all the [default logotypes](https://github.com/filebrowser/filebrowser/tree/master/frontend/public/img) from the application. - -This can be configured by the administrator user, under **Settings → Global Settings**. You can also update the configuration directly using the CLI: - -```sh -filebrowser config set --branding.name "My Name" \ - --branding.files "/abs/path/to/my/dir" \ - --branding.disableExternal -``` - -> [!NOTE] -> -> If you are using Docker, you need to mount a volume with the `branding` directory in order for it to be accessible from within the container. - -### Custom Icons - -To replace the default logotype and favicons, you need to create an `img` directory under the branding directory. The structure of this directory must mimic the one from the [default logotypes](https://github.com/filebrowser/filebrowser/tree/master/frontend/public/img): - -``` -img/ - logo.svg - icons/ - favicon.ico - favicon.svg - (...) -``` - -Note that there are different versions of the same favicon in multiple sizes. To replace all of them, you need to add versions for all of them. You can use the [Real Favicon Generator](https://realfavicongenerator.net/) to generate these for you from your base image. - -> [!NOTE] -> -> The icons are cached by the browser, so you may not see your changes immediately. You can address this by clearing your browser's cache. - -## Authentication Method - -Right now, there are three possible authentication methods. Each one of them has its own capabilities and specification. If you are interested in contributing with one more authentication method, please [check the guidelines](contributing.md). - -### JSON Auth (default) - -We call it JSON Authentication but it is just the default authentication method and the one that is provided by default if you don't make any changes. It is set by default, but if you've made changes before you can revert to using JSON auth: - -```sh -filebrowser config set --auth.method=json -``` - -This method can also be extended with **reCAPTCHA** verification during login: - -```sh -filebrowser config set --auth.method=json \ - --recaptcha.key site-key \ - --recaptcha.secret private-key -``` - -By default, we use [Google's reCAPTCHA](https://developers.google.com/recaptcha/docs/display) service. If you live in China, or want to use other provider, you can change the host with the following command: - -```sh -filebrowser config set --recaptcha.host https://recaptcha.net -``` - -Where `https://recaptcha.net` is any provider you want. - -### Proxy Header - -If you have a reverse proxy you want to use to login your users, you do it via our `proxy` authentication method. To configure this method, your proxy must send an HTTP header containing the username of the logged in user: - -```sh -filebrowser config set --auth.method=proxy --auth.header=X-My-Header -``` - -Where `X-My-Header` is the HTTP header provided by your proxy with the username. - -> [!WARNING] -> -> File Browser will blindly trust the provided header. If the proxy can be bypassed, an attacker could simply attach the header and get admin access. - -### No Authentication - -We also provide a no authentication mechanism for users that want to use File Browser privately such in a home network. By setting this authentication method, the user with **id 1** will be used as the default users. Creating more users won't have any effect. - -```sh -filebrowser config set --auth.method=noauth -``` - -## Command Runner - -> [!CAUTION] -> -> The **command execution** functionality has been disabled for all existent and new installations by default from version v2.33.8 and onwards, due to continuous and known security vulnerabilities. You should only use this feature if you are aware of all of the security risks involved. For more up to date information, consult issue [#5199](https://github.com/filebrowser/filebrowser/issues/5199). - -The command runner is a feature that enables you to execute any shell command you want before or after a certain event. Right now, these are the events: - -* Copy -* Rename -* Upload -* Delete -* Save - -Also, during the execution of the commands set for those hooks, there will be some environment variables available to help you perform your commands: - -* `FILE` with the full absolute path to the changed file. -* `SCOPE` with the path to user's scope. -* `TRIGGER` with the name of the event. -* `USERNAME` with the user's username. -* `DESTINATION` with the absolute path to the destination. Only used for **copy** and **rename.** - -At this moment, you can edit the commands via the command line interface, using the following commands \(please check the flag `--help` to know more about them\): - -```bash -filebrowser cmds add before_copy "echo $FILE" -filebrowser cmds rm before_copy 0 -filebrowser cmds ls -``` - -Or you can use the web interface to manage them via **Settings** → **Global Settings**. - -## Command Execution - -> [!CAUTION] -> -> The **command execution** functionality has been disabled for all existent and new installations by default from version v2.33.8 and onwards, due to continuous and known security vulnerabilities. You should only use this feature if you are aware of all of the security risks involved. For more up to date information, consult issue [#5199](https://github.com/filebrowser/filebrowser/issues/5199). - -Within File Browser you can toggle the shell (`< >` icon at the top right) and this will open a shell command window at the bottom of the screen. This functionality can be turned on using the environment variable `FB_DISABLE_EXEC=false` or the flag `--disable-exec=false`. - -By default no commands are available as the command list is empty. To enable commands these need to either be done on a per-user basis (including for the Admin user). - -You can do this by adding them in Settings > User Management > (edit user) > Commands or to *apply to all new users created from that point forward* they can be set in Settings > Global Settings - -> [!NOTE] -> -> If using a proxy manager then remember to enable websockets support for the File Browser proxy - -> [!NOTE] -> -> If using Docker and you want to add a new command that is not in the base image then you will need to build a custom Docker image using `filebrowser/filebrowser` as a base image. For example to add 7z: -> -> ```docker -> FROM filebrowser/filebrowser -> RUN sudo apt install p7zip-full -> ``` diff --git a/filebrowser/www/docs/customization.md b/filebrowser/www/docs/customization.md new file mode 100644 index 0000000000..054da7ab7a --- /dev/null +++ b/filebrowser/www/docs/customization.md @@ -0,0 +1,45 @@ +# Customization + +You can customize the styles, branding and icons of your File Browser instance in order to give it a personal touch. + +## Custom Branding + +You can customize File Browser to use your own branding. This includes the following: + +- **Name**: the name of the instance that shows up on the tab title, login pages, and some other places. +- **Disable External Links**: disables all external links, except to the documentation. +- **Disable Used Percentage**: disables the disk usage information on the sidebar. +- **Branding Folder**: directory which can contain two items: + - `custom.css`, containing a global stylesheet to apply to all users. + - `img`, a directory which can replace all the [default logotypes](https://github.com/filebrowser/filebrowser/tree/master/frontend/public/img) from the application. + +This can be configured by the administrator user, under **Settings → Global Settings**. You can also update the configuration directly using the [CLI](cli/filebrowser-config-set.md): + +```sh +filebrowser config set --branding.name "My Name" \ + --branding.files "/abs/path/to/my/dir" \ + --branding.disableExternal +``` + +> [!NOTE] +> +> If you are using Docker, you need to mount a volume with the `branding` directory in order for it to be accessible from within the container. + +### Custom Icons + +To replace the default logotype and favicons, you need to create an `img` directory under the branding directory. The structure of this directory must mimic the one from the [default logotypes](https://github.com/filebrowser/filebrowser/tree/master/frontend/public/img): + +``` +img/ + logo.svg + icons/ + favicon.ico + favicon.svg + (...) +``` + +Note that there are different versions of the same favicon in multiple sizes. To replace all of them, you need to add versions for all of them. You can use the [Real Favicon Generator](https://realfavicongenerator.net/) to generate these for you from your base image. + +> [!NOTE] +> +> The icons are cached by the browser, so you may not see your changes immediately. You can address this by clearing your browser's cache. diff --git a/filebrowser/www/docs/installation.md b/filebrowser/www/docs/installation.md index 741e8c1ab6..6acb8db625 100644 --- a/filebrowser/www/docs/installation.md +++ b/filebrowser/www/docs/installation.md @@ -88,6 +88,6 @@ Your instance is now up and running. File Browser will automatically bootstrap a > > The automatically generated password for the user `admin` is only displayed once. If you fail to remember it, you will need to manually delete the database and start File Browser again. -Although this is the fastest way to bootstrap an instance, we recommend you to take a look at other possible options, by checking `config init --help` and `config set --help`, to make the installation as safe and customized as it can be. +Although this is the fastest way to bootstrap an instance, we recommend you to take a look at other possible options, by checking [`config init`](cli/filebrowser-config-init.md) and [`config set`](cli/filebrowser-config-set.md), to make the installation as safe and customized as it can be. If your goal is to have a public-facing deployment, we recommend taking a look at the [deployment](deployment.md) page for more information on how you can secure your installation. diff --git a/filebrowser/www/mkdocs.yml b/filebrowser/www/mkdocs.yml index d489dcd591..7558c53464 100644 --- a/filebrowser/www/mkdocs.yml +++ b/filebrowser/www/mkdocs.yml @@ -34,8 +34,6 @@ theme: features: - navigation.tabs - navigation.tabs.sticky - - navigation.sections - - navigation.expand - navigation.indexes - navigation.top - navigation.instant @@ -44,7 +42,6 @@ theme: - search.share - content.code.copy - toc.follow - - toc.integrate icon: repo: fontawesome/brands/github @@ -97,10 +94,44 @@ extra: nav: - Home: index.md - - Getting Started: + - Documentation: - Installation: installation.md - - Configuration: configuration.md + - Configuration: + - customization.md + - authentication.md + - command-execution.md - Deployment: deployment.md + - Command Line Usage: + - cli/filebrowser.md + - cli/filebrowser-cmds.md + - cli/filebrowser-cmds-add.md + - cli/filebrowser-cmds-ls.md + - cli/filebrowser-cmds-rm.md + - cli/filebrowser-completion.md + - cli/filebrowser-completion-bash.md + - cli/filebrowser-completion-fish.md + - cli/filebrowser-completion-powershell.md + - cli/filebrowser-completion-zsh.md + - cli/filebrowser-config.md + - cli/filebrowser-config-cat.md + - cli/filebrowser-config-export.md + - cli/filebrowser-config-import.md + - cli/filebrowser-config-init.md + - cli/filebrowser-config-set.md + - cli/filebrowser-hash.md + - cli/filebrowser-rules.md + - cli/filebrowser-rules-add.md + - cli/filebrowser-rules-ls.md + - cli/filebrowser-rules-rm.md + - cli/filebrowser-users.md + - cli/filebrowser-users-add.md + - cli/filebrowser-users-export.md + - cli/filebrowser-users-find.md + - cli/filebrowser-users-import.md + - cli/filebrowser-users-ls.md + - cli/filebrowser-users-rm.md + - cli/filebrowser-users-update.md + - cli/filebrowser-version.md - Contributing: - Contributing: contributing.md - Code of Conduct: code-of-conduct.md diff --git a/lede/target/linux/mediatek/filogic/config-6.12 b/lede/target/linux/mediatek/filogic/config-6.12 index 8e47cb8adb..441ab698a8 100644 --- a/lede/target/linux/mediatek/filogic/config-6.12 +++ b/lede/target/linux/mediatek/filogic/config-6.12 @@ -72,6 +72,7 @@ CONFIG_COMMON_CLK_MT7981=y CONFIG_COMMON_CLK_MT7981_ETHSYS=y CONFIG_COMMON_CLK_MT7986=y CONFIG_COMMON_CLK_MT7986_ETHSYS=y +CONFIG_COMMON_CLK_MT7987=y CONFIG_COMMON_CLK_MT7988=y # CONFIG_COMMON_CLK_MT8173 is not set # CONFIG_COMMON_CLK_MT8183 is not set @@ -395,6 +396,7 @@ CONFIG_PINCTRL=y # CONFIG_PINCTRL_MT7622 is not set CONFIG_PINCTRL_MT7981=y CONFIG_PINCTRL_MT7986=y +CONFIG_PINCTRL_MT7987=y CONFIG_PINCTRL_MT7988=y # CONFIG_PINCTRL_MT8173 is not set # CONFIG_PINCTRL_MT8183 is not set diff --git a/lede/target/linux/mediatek/mt7622/config-6.12 b/lede/target/linux/mediatek/mt7622/config-6.12 index fb2064e899..f45e9263d2 100644 --- a/lede/target/linux/mediatek/mt7622/config-6.12 +++ b/lede/target/linux/mediatek/mt7622/config-6.12 @@ -80,6 +80,7 @@ CONFIG_COMMON_CLK_MT7622_ETHSYS=y CONFIG_COMMON_CLK_MT7622_HIFSYS=y # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7987 is not set # CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8173 is not set # CONFIG_COMMON_CLK_MT8183 is not set @@ -385,6 +386,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_MT7622=y # CONFIG_PINCTRL_MT7981 is not set # CONFIG_PINCTRL_MT7986 is not set +# CONFIG_PINCTRL_MT7987 is not set # CONFIG_PINCTRL_MT7988 is not set # CONFIG_PINCTRL_MT8173 is not set # CONFIG_PINCTRL_MT8183 is not set diff --git a/lede/target/linux/mediatek/mt7623/config-6.12 b/lede/target/linux/mediatek/mt7623/config-6.12 index 0dbacb0f00..892f387e09 100644 --- a/lede/target/linux/mediatek/mt7623/config-6.12 +++ b/lede/target/linux/mediatek/mt7623/config-6.12 @@ -80,6 +80,7 @@ CONFIG_COMMON_CLK_MT2701_VDECSYS=y # CONFIG_COMMON_CLK_MT7629 is not set # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7987 is not set # CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8135 is not set # CONFIG_COMMON_CLK_MT8365 is not set diff --git a/lede/target/linux/mediatek/mt7629/config-6.12 b/lede/target/linux/mediatek/mt7629/config-6.12 index 80053bdbcd..49787c532c 100644 --- a/lede/target/linux/mediatek/mt7629/config-6.12 +++ b/lede/target/linux/mediatek/mt7629/config-6.12 @@ -58,6 +58,7 @@ CONFIG_COMMON_CLK_MT7629_ETHSYS=y CONFIG_COMMON_CLK_MT7629_HIFSYS=y # CONFIG_COMMON_CLK_MT7981 is not set # CONFIG_COMMON_CLK_MT7986 is not set +# CONFIG_COMMON_CLK_MT7987 is not set # CONFIG_COMMON_CLK_MT7988 is not set # CONFIG_COMMON_CLK_MT8135 is not set # CONFIG_COMMON_CLK_MT8365 is not set diff --git a/lede/target/linux/mediatek/patches-6.12/360-pinctrl-mediatek-add-mt7987-pinctrl-support.patch b/lede/target/linux/mediatek/patches-6.12/360-pinctrl-mediatek-add-mt7987-pinctrl-support.patch new file mode 100644 index 0000000000..c22be8cd1d --- /dev/null +++ b/lede/target/linux/mediatek/patches-6.12/360-pinctrl-mediatek-add-mt7987-pinctrl-support.patch @@ -0,0 +1,793 @@ +From e37d53fb387eb788dff33cdc4c1009543e2ccd5f Mon Sep 17 00:00:00 2001 +From: Sam Shih +Date: Mon, 20 Jan 2025 19:49:34 +0800 +Subject: [PATCH 1/2] pinctrl: mediatek: add mt7987 pinctrl support + +Signed-off-by: Daniel Golle +--- + drivers/pinctrl/mediatek/Kconfig | 6 + + drivers/pinctrl/mediatek/Makefile | 1 + + drivers/pinctrl/mediatek/pinctrl-mt7987.c | 752 ++++++++++++++++++++++ + 3 files changed, 759 insertions(+) + create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7987.c + +--- a/drivers/pinctrl/mediatek/Kconfig ++++ b/drivers/pinctrl/mediatek/Kconfig +@@ -187,6 +187,13 @@ config PINCTRL_MT7986 + default ARM64 && ARCH_MEDIATEK + select PINCTRL_MTK_MOORE + ++config PINCTRL_MT7987 ++ bool "Mediatek MT7987 pin control" ++ depends on OF ++ depends on ARM64 || COMPILE_TEST ++ default ARM64 && ARCH_MEDIATEK ++ select PINCTRL_MTK_MOORE ++ + config PINCTRL_MT7988 + bool "Mediatek MT7988 pin control" + depends on OF +--- a/drivers/pinctrl/mediatek/Makefile ++++ b/drivers/pinctrl/mediatek/Makefile +@@ -27,6 +27,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl + obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o + obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o + obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o ++obj-$(CONFIG_PINCTRL_MT7987) += pinctrl-mt7987.o + obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o + obj-$(CONFIG_PINCTRL_MT8167) += pinctrl-mt8167.o + obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o +--- /dev/null ++++ b/drivers/pinctrl/mediatek/pinctrl-mt7987.c +@@ -0,0 +1,751 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * The MT7987 driver based on Linux generic pinctrl binding. ++ * ++ * Copyright (C) 2020 MediaTek Inc. ++ * Author: Tim.Kuo ++ */ ++ ++#include "pinctrl-moore.h" ++ ++enum MT7987_PINCTRL_REG_PAGE { ++ GPIO_BASE, ++ IOCFG_RB_BASE, ++ IOCFG_LB_BASE, ++ IOCFG_RT1_BASE, ++ IOCFG_RT2_BASE, ++ IOCFG_TL_BASE, ++}; ++ ++#define MT7987_PIN(_number, _name) MTK_PIN(_number, _name, 0, _number, DRV_GRP4) ++ ++#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits) \ ++ PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits, 32, 0) ++ ++#define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits) \ ++ PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits, 32, 0) ++ ++ ++#define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits) \ ++ PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ ++ _x_bits, 32, 1) ++ ++static const struct mtk_pin_field_calc mt7987_pin_mode_range[] = { ++ PIN_FIELD(0, 49, 0x300, 0x10, 0, 4), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_dir_range[] = { ++ PIN_FIELD(0, 49, 0x0, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_di_range[] = { ++ PIN_FIELD(0, 49, 0x200, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_do_range[] = { ++ PIN_FIELD(0, 49, 0x100, 0x10, 0, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_ies_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x20, 0x10, 3, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x20, 0x10, 2, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x20, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x20, 0x10, 2, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x20, 0x10, 1, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x20, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x20, 0x10, 0, 1), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x20, 0x10, 4, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x10, 0x10, 2, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x10, 0x10, 1, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x10, 0x10, 0, 1), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x10, 0x10, 3, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x10, 0x10, 4, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0x20, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0x20, 0x10, 15, 1), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0x20, 0x10, 3, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0x20, 0x10, 7, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0x20, 0x10, 6, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0x20, 0x10, 4, 1), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0x20, 0x10, 5, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0x20, 0x10, 8, 1), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0x20, 0x10, 9, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0x20, 0x10, 12, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0x20, 0x10, 11, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0x20, 0x10, 10, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0x20, 0x10, 13, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0x20, 0x10, 14, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x20, 0x10, 9, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x20, 0x10, 7, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x20, 0x10, 8, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x20, 0x10, 10, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x20, 0x10, 5, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x20, 0x10, 6, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_LB_BASE, 0x20, 0x10, 2, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_LB_BASE, 0x20, 0x10, 0, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_LB_BASE, 0x20, 0x10, 4, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_LB_BASE, 0x20, 0x10, 3, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_LB_BASE, 0x20, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_LB_BASE, 0x20, 0x10, 5, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0x20, 0x10, 1, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0x20, 0x10, 2, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x20, 0x10, 0, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x20, 0x10, 1, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x20, 0x10, 4, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x20, 0x10, 5, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x20, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x20, 0x10, 9, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x20, 0x10, 10, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x20, 0x10, 7, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x20, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_smt_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x90, 0x10, 3, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x90, 0x10, 2, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x90, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x90, 0x10, 2, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x90, 0x10, 1, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x90, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x90, 0x10, 0, 1), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x90, 0x10, 4, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x70, 0x10, 2, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x70, 0x10, 1, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x70, 0x10, 0, 1), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x70, 0x10, 3, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x70, 0x10, 4, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0xA0, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0xA0, 0x10, 15, 1), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0xA0, 0x10, 3, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0xA0, 0x10, 7, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0xA0, 0x10, 6, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0xA0, 0x10, 4, 1), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0xA0, 0x10, 5, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0xA0, 0x10, 8, 1), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0xA0, 0x10, 9, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0xA0, 0x10, 12, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0xA0, 0x10, 11, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0xA0, 0x10, 10, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0xA0, 0x10, 13, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0xA0, 0x10, 14, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x90, 0x10, 9, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x90, 0x10, 7, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x90, 0x10, 8, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x90, 0x10, 10, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x90, 0x10, 5, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x90, 0x10, 6, 1), ++ PIN_FIELD_BASE(33, 33, IOCFG_LB_BASE, 0x60, 0x10, 2, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_LB_BASE, 0x60, 0x10, 0, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_LB_BASE, 0x60, 0x10, 4, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_LB_BASE, 0x60, 0x10, 3, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_LB_BASE, 0x60, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_LB_BASE, 0x60, 0x10, 5, 1), ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0xA0, 0x10, 1, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0xA0, 0x10, 2, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x90, 0x10, 0, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x90, 0x10, 1, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x90, 0x10, 4, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x90, 0x10, 5, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x90, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x90, 0x10, 9, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x90, 0x10, 10, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x90, 0x10, 7, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x90, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_pu_range[] = { ++ PIN_FIELD_BASE(33, 33, IOCFG_LB_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_LB_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_LB_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_LB_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_LB_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_LB_BASE, 0x40, 0x10, 5, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_pd_range[] = { ++ PIN_FIELD_BASE(33, 33, IOCFG_LB_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(34, 34, IOCFG_LB_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(35, 35, IOCFG_LB_BASE, 0x30, 0x10, 4, 1), ++ PIN_FIELD_BASE(36, 36, IOCFG_LB_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(37, 37, IOCFG_LB_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(38, 38, IOCFG_LB_BASE, 0x30, 0x10, 5, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_drv_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x0, 0x10, 9, 3), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x0, 0x10, 6, 3), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x10, 0x10, 3, 3), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x0, 0x10, 6, 3), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x0, 0x10, 3, 3), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x0, 0x10, 9, 3), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x0, 0x10, 0, 3), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x0, 0x10, 12, 3), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x0, 0x10, 6, 3), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x0, 0x10, 3, 3), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x0, 0x10, 0, 3), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x0, 0x10, 9, 3), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x0, 0x10, 12, 3), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0x0, 0x10, 0, 3), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0x10, 0x10, 15, 3), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0x0, 0x10, 9, 3), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0x0, 0x10, 21, 3), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0x0, 0x10, 18, 3), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0x0, 0x10, 12, 3), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0x0, 0x10, 15, 3), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0x0, 0x10, 24, 3), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0x0, 0x10, 27, 3), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0x10, 0x10, 6, 3), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0x10, 0x10, 3, 3), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0x10, 0x10, 9, 3), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0x10, 0x10, 12, 3), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x0, 0x10, 27, 3), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x0, 0x10, 21, 3), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x0, 0x10, 24, 3), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x0, 0x10, 15, 3), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x0, 0x10, 18, 3), ++ PIN_FIELD_BASE(33, 33, IOCFG_LB_BASE, 0x0, 0x10, 6, 3), ++ PIN_FIELD_BASE(34, 34, IOCFG_LB_BASE, 0x0, 0x10, 0, 3), ++ PIN_FIELD_BASE(35, 35, IOCFG_LB_BASE, 0x0, 0x10, 12, 3), ++ PIN_FIELD_BASE(36, 36, IOCFG_LB_BASE, 0x0, 0x10, 9, 3), ++ PIN_FIELD_BASE(37, 37, IOCFG_LB_BASE, 0x0, 0x10, 3, 3), ++ PIN_FIELD_BASE(38, 38, IOCFG_LB_BASE, 0x0, 0x10, 15, 3), ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0x0, 0x10, 3, 3), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0x0, 0x10, 6, 3), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x0, 0x10, 0, 3), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x0, 0x10, 3, 3), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x0, 0x10, 12, 3), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x0, 0x10, 15, 3), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x0, 0x10, 18, 3), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x0, 0x10, 27, 3), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x10, 0x10, 0, 3), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x0, 0x10, 21, 3), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x0, 0x10, 24, 3), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_pupd_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x30, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x30, 0x10, 4, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x20, 0x10, 2, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x20, 0x10, 1, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x20, 0x10, 0, 1), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x20, 0x10, 3, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x20, 0x10, 4, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0x30, 0x10, 15, 1), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0x30, 0x10, 7, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0x30, 0x10, 6, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0x30, 0x10, 4, 1), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0x30, 0x10, 5, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0x30, 0x10, 8, 1), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0x30, 0x10, 9, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0x30, 0x10, 12, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0x30, 0x10, 11, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0x30, 0x10, 10, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0x30, 0x10, 13, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0x30, 0x10, 14, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x30, 0x10, 9, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x30, 0x10, 7, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x30, 0x10, 8, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x30, 0x10, 10, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x30, 0x10, 5, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x30, 0x10, 6, 1), ++ ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x30, 0x10, 4, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x30, 0x10, 5, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x30, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x30, 0x10, 9, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x30, 0x10, 10, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x30, 0x10, 7, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x30, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_r0_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x40, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x30, 0x10, 2, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x30, 0x10, 1, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x30, 0x10, 0, 1), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x30, 0x10, 3, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x30, 0x10, 4, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0x40, 0x10, 15, 1), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0x40, 0x10, 7, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0x40, 0x10, 6, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0x40, 0x10, 8, 1), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0x40, 0x10, 9, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0x40, 0x10, 12, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0x40, 0x10, 11, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0x40, 0x10, 10, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0x40, 0x10, 13, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0x40, 0x10, 14, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x40, 0x10, 9, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x40, 0x10, 7, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x40, 0x10, 8, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x40, 0x10, 10, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x40, 0x10, 6, 1), ++ ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x40, 0x10, 5, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x40, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x40, 0x10, 9, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x40, 0x10, 10, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x40, 0x10, 7, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x40, 0x10, 8, 1), ++}; ++ ++static const struct mtk_pin_field_calc mt7987_pin_r1_range[] = { ++ PIN_FIELD_BASE(0, 0, IOCFG_RT2_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(1, 1, IOCFG_RT2_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(2, 2, IOCFG_RT2_BASE, 0x50, 0x10, 11, 1), ++ PIN_FIELD_BASE(3, 3, IOCFG_TL_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(4, 4, IOCFG_TL_BASE, 0x50, 0x10, 1, 1), ++ PIN_FIELD_BASE(5, 5, IOCFG_TL_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(6, 6, IOCFG_TL_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(7, 7, IOCFG_TL_BASE, 0x50, 0x10, 4, 1), ++ PIN_FIELD_BASE(8, 8, IOCFG_RB_BASE, 0x40, 0x10, 2, 1), ++ PIN_FIELD_BASE(9, 9, IOCFG_RB_BASE, 0x40, 0x10, 1, 1), ++ PIN_FIELD_BASE(10, 10, IOCFG_RB_BASE, 0x40, 0x10, 0, 1), ++ PIN_FIELD_BASE(11, 11, IOCFG_RB_BASE, 0x40, 0x10, 3, 1), ++ PIN_FIELD_BASE(12, 12, IOCFG_RB_BASE, 0x40, 0x10, 4, 1), ++ PIN_FIELD_BASE(13, 13, IOCFG_RT1_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(14, 14, IOCFG_RT1_BASE, 0x50, 0x10, 15, 1), ++ PIN_FIELD_BASE(15, 15, IOCFG_RT1_BASE, 0x50, 0x10, 3, 1), ++ PIN_FIELD_BASE(16, 16, IOCFG_RT1_BASE, 0x50, 0x10, 7, 1), ++ PIN_FIELD_BASE(17, 17, IOCFG_RT1_BASE, 0x50, 0x10, 6, 1), ++ PIN_FIELD_BASE(18, 18, IOCFG_RT1_BASE, 0x50, 0x10, 4, 1), ++ PIN_FIELD_BASE(19, 19, IOCFG_RT1_BASE, 0x50, 0x10, 5, 1), ++ PIN_FIELD_BASE(20, 20, IOCFG_RT1_BASE, 0x50, 0x10, 8, 1), ++ PIN_FIELD_BASE(21, 21, IOCFG_RT1_BASE, 0x50, 0x10, 9, 1), ++ PIN_FIELD_BASE(22, 22, IOCFG_RT1_BASE, 0x50, 0x10, 12, 1), ++ PIN_FIELD_BASE(23, 23, IOCFG_RT1_BASE, 0x50, 0x10, 11, 1), ++ PIN_FIELD_BASE(24, 24, IOCFG_RT1_BASE, 0x50, 0x10, 10, 1), ++ PIN_FIELD_BASE(25, 25, IOCFG_RT1_BASE, 0x50, 0x10, 13, 1), ++ PIN_FIELD_BASE(26, 26, IOCFG_RT1_BASE, 0x50, 0x10, 14, 1), ++ PIN_FIELD_BASE(27, 27, IOCFG_RT2_BASE, 0x50, 0x10, 9, 1), ++ PIN_FIELD_BASE(28, 28, IOCFG_RT2_BASE, 0x50, 0x10, 7, 1), ++ PIN_FIELD_BASE(29, 29, IOCFG_RT2_BASE, 0x50, 0x10, 8, 1), ++ PIN_FIELD_BASE(30, 30, IOCFG_RT2_BASE, 0x50, 0x10, 10, 1), ++ PIN_FIELD_BASE(31, 31, IOCFG_TL_BASE, 0x50, 0x10, 5, 1), ++ PIN_FIELD_BASE(32, 32, IOCFG_TL_BASE, 0x50, 0x10, 6, 1), ++ ++ PIN_FIELD_BASE(39, 39, IOCFG_RT1_BASE, 0x50, 0x10, 1, 1), ++ PIN_FIELD_BASE(40, 40, IOCFG_RT1_BASE, 0x50, 0x10, 2, 1), ++ PIN_FIELD_BASE(41, 41, IOCFG_RT2_BASE, 0x50, 0x10, 0, 1), ++ PIN_FIELD_BASE(42, 42, IOCFG_RT2_BASE, 0x50, 0x10, 1, 1), ++ PIN_FIELD_BASE(43, 43, IOCFG_RT2_BASE, 0x50, 0x10, 4, 1), ++ PIN_FIELD_BASE(44, 44, IOCFG_RT2_BASE, 0x50, 0x10, 5, 1), ++ PIN_FIELD_BASE(45, 45, IOCFG_RT2_BASE, 0x50, 0x10, 6, 1), ++ PIN_FIELD_BASE(46, 46, IOCFG_TL_BASE, 0x50, 0x10, 9, 1), ++ PIN_FIELD_BASE(47, 47, IOCFG_TL_BASE, 0x50, 0x10, 10, 1), ++ PIN_FIELD_BASE(48, 48, IOCFG_TL_BASE, 0x50, 0x10, 7, 1), ++ PIN_FIELD_BASE(49, 49, IOCFG_TL_BASE, 0x50, 0x10, 8, 1), ++}; ++ ++static const unsigned int mt7987_pull_type[] = { ++ MTK_PULL_PUPD_R1R0_TYPE,/*0*/ MTK_PULL_PUPD_R1R0_TYPE,/*1*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*2*/ MTK_PULL_PUPD_R1R0_TYPE,/*3*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*4*/ MTK_PULL_PUPD_R1R0_TYPE,/*5*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*6*/ MTK_PULL_PUPD_R1R0_TYPE,/*7*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*8*/ MTK_PULL_PUPD_R1R0_TYPE,/*9*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*10*/ MTK_PULL_PUPD_R1R0_TYPE,/*11*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*12*/ MTK_PULL_PUPD_R1R0_TYPE,/*13*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*14*/ MTK_PULL_PUPD_R1R0_TYPE,/*15*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*16*/ MTK_PULL_PUPD_R1R0_TYPE,/*17*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*18*/ MTK_PULL_PUPD_R1R0_TYPE,/*19*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*20*/ MTK_PULL_PUPD_R1R0_TYPE,/*21*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*22*/ MTK_PULL_PUPD_R1R0_TYPE,/*23*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*24*/ MTK_PULL_PUPD_R1R0_TYPE,/*25*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*26*/ MTK_PULL_PUPD_R1R0_TYPE,/*27*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*28*/ MTK_PULL_PUPD_R1R0_TYPE,/*29*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*30*/ MTK_PULL_PUPD_R1R0_TYPE,/*31*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*32*/ MTK_PULL_PU_PD_TYPE,/*33*/ ++ MTK_PULL_PU_PD_TYPE,/*34*/ MTK_PULL_PU_PD_TYPE,/*35*/ ++ MTK_PULL_PU_PD_TYPE,/*36*/ MTK_PULL_PU_PD_TYPE,/*37*/ ++ MTK_PULL_PU_PD_TYPE,/*38*/ MTK_PULL_PUPD_R1R0_TYPE,/*39*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*40*/ MTK_PULL_PUPD_R1R0_TYPE,/*41*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*42*/ MTK_PULL_PUPD_R1R0_TYPE,/*43*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*44*/ MTK_PULL_PUPD_R1R0_TYPE,/*45*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*46*/ MTK_PULL_PUPD_R1R0_TYPE,/*47*/ ++ MTK_PULL_PUPD_R1R0_TYPE,/*48*/ MTK_PULL_PUPD_R1R0_TYPE,/*49*/ ++}; ++ ++static const struct mtk_pin_reg_calc mt7987_reg_cals[] = { ++ [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7987_pin_mode_range), ++ [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7987_pin_dir_range), ++ [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt7987_pin_di_range), ++ [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt7987_pin_do_range), ++ [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt7987_pin_smt_range), ++ [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt7987_pin_ies_range), ++ [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt7987_pin_pu_range), ++ [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt7987_pin_pd_range), ++ [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7987_pin_drv_range), ++ [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7987_pin_pupd_range), ++ [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7987_pin_r0_range), ++ [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7987_pin_r1_range), ++}; ++ ++static const struct mtk_pin_desc mt7987_pins[] = { ++ MT7987_PIN(0, "GPIO_WPS"), ++ MT7987_PIN(1, "GPIO_RESET"), ++ MT7987_PIN(2, "SYS_WATCHDOG"), ++ MT7987_PIN(3, "JTAG_JTDO"), ++ MT7987_PIN(4, "JTAG_JTDI"), ++ MT7987_PIN(5, "JTAG_JTMS"), ++ MT7987_PIN(6, "JTAG_JTCLK"), ++ MT7987_PIN(7, "JTAG_JTRST_N"), ++ MT7987_PIN(8, "PCM_DTX_I2S_DOUT"), ++ MT7987_PIN(9, "PCM_DRX_I2S_DIN"), ++ MT7987_PIN(10, "PCM_CLK_I2S_BCLK"), ++ MT7987_PIN(11, "PCM_FS_I2S_LRCK"), ++ MT7987_PIN(12, "PCM_MCK_I2S_MCLK"), ++ MT7987_PIN(13, "PWM0"), ++ MT7987_PIN(14, "USB_VBUS"), ++ MT7987_PIN(15, "SPI0_CLK"), ++ MT7987_PIN(16, "SPI0_MOSI"), ++ MT7987_PIN(17, "SPI0_MISO"), ++ MT7987_PIN(18, "SPI0_CS"), ++ MT7987_PIN(19, "SPI0_HOLD"), ++ MT7987_PIN(20, "SPI0_WP"), ++ MT7987_PIN(21, "SPI1_CLK"), ++ MT7987_PIN(22, "SPI1_MOSI"), ++ MT7987_PIN(23, "SPI1_MISO"), ++ MT7987_PIN(24, "SPI1_CS"), ++ MT7987_PIN(25, "SPI2_CLK"), ++ MT7987_PIN(26, "SPI2_MOSI"), ++ MT7987_PIN(27, "SPI2_MISO"), ++ MT7987_PIN(28, "SPI2_CS"), ++ MT7987_PIN(29, "SPI2_HOLD"), ++ MT7987_PIN(30, "SPI2_WP"), ++ MT7987_PIN(31, "UART0_RXD"), ++ MT7987_PIN(32, "UART0_TXD"), ++ MT7987_PIN(33, "PCIE_PERESET_N_0"), ++ MT7987_PIN(34, "PCIE_CLK_REQ_0"), ++ MT7987_PIN(35, "PCIE_WAKE_N_0"), ++ MT7987_PIN(36, "PCIE_PERESET_N_1"), ++ MT7987_PIN(37, "PCIE_CLK_REQ_1"), ++ MT7987_PIN(38, "PCIE_WAKE_N_1"), ++ MT7987_PIN(39, "SMI_MDC"), ++ MT7987_PIN(40, "SMI_MDIO"), ++ MT7987_PIN(41, "GBE_INT"), ++ MT7987_PIN(42, "GBE_RESET"), ++ MT7987_PIN(43, "I2C_SCLK"), ++ MT7987_PIN(44, "I2C_SDATA"), ++ MT7987_PIN(45, "2P5G_LED0"), ++ MT7987_PIN(46, "UART1_RXD"), ++ MT7987_PIN(47, "UART1_TXD"), ++ MT7987_PIN(48, "UART1_CTS"), ++ MT7987_PIN(49, "UART1_RTS"), ++}; ++ ++/* watchdog */ ++static int mt7987_watchdog_pins[] = {2}; ++static int mt7987_watchdog_funcs[] = {1}; ++ ++/* jtag */ ++static int mt7987_jtag_pins[] = {3, 4, 5, 6, 7}; ++static int mt7987_jtag_funcs[] = {1, 1, 1, 1, 1}; ++ ++/* i2s */ ++static int mt7987_i2s_pins[] = { 8, 9, 10, 11, 12 }; ++static int mt7987_i2s_funcs[] = { 1, 1, 1, 1, 1 }; ++ ++/* pcm */ ++static int mt7987_pcm_pins[] = { 8, 9, 10, 11 }; ++static int mt7987_pcm_funcs[] = { 1, 1, 1, 1 }; ++ ++/* uart */ ++static int mt7987_uart0_pins[] = {31, 32}; ++static int mt7987_uart0_funcs[] = {1, 1}; ++ ++static int mt7987_uart1_0_pins[] = {3, 4, 5, 6}; ++static int mt7987_uart1_0_funcs[] = {3, 3, 3, 3}; ++ ++static int mt7987_uart1_0_lite_pins[] = {3, 4}; ++static int mt7987_uart1_0_lite_funcs[] = {3, 3}; ++ ++static int mt7987_uart1_1_pins[] = {21, 22, 23, 24}; ++static int mt7987_uart1_1_funcs[] = {3, 3, 3, 3}; ++ ++static int mt7987_uart1_2_pins[] = {46, 47, 48, 49}; ++static int mt7987_uart1_2_funcs[] = {1, 1, 1, 1}; ++ ++static int mt7987_uart2_0_pins[] = {8, 9, 10, 11}; ++static int mt7987_uart2_0_funcs[] = {2, 2, 2, 2}; ++ ++static int mt7987_uart2_1_pins[] = {25, 26, 27, 28}; ++static int mt7987_uart2_1_funcs[] = {2, 2, 2, 2}; ++ ++/* pwm */ ++static int mt7987_pwm0_pins[] = {13}; ++static int mt7987_pwm0_funcs[] = {1}; ++ ++static int mt7987_pwm1_0_pins[] = {7}; ++static int mt7987_pwm1_0_funcs[] = {3}; ++ ++static int mt7987_pwm1_1_pins[] = {43}; ++static int mt7987_pwm1_1_funcs[] = {2}; ++ ++static int mt7987_pwm2_0_pins[] = {12}; ++static int mt7987_pwm2_0_funcs[] = {2}; ++ ++static int mt7987_pwm2_1_pins[] = {44}; ++static int mt7987_pwm2_1_funcs[] = {2}; ++ ++/* vbus */ ++static int mt7987_drv_vbus_p1_pins[] = {14}; ++static int mt7987_drv_vbus_p1_funcs[] = {1}; ++ ++static int mt7987_drv_vbus_pins[] = {48}; ++static int mt7987_drv_vbus_funcs[] = {3}; ++ ++/* 2p5gbe_led */ ++static int mt7987_2p5gbe_led0_pins[] = {45}; ++static int mt7987_2p5gbe_led0_funcs[] = {1}; ++ ++static int mt7987_2p5gbe_led1_0_pins[] = {13}; ++static int mt7987_2p5gbe_led1_0_funcs[] = {2}; ++ ++static int mt7987_2p5gbe_led1_1_pins[] = {49}; ++static int mt7987_2p5gbe_led1_1_funcs[] = {3}; ++ ++/* mdc, mdio */ ++static int mt7987_2p5g_ext_mdc_mdio_pins[] = {23, 24}; ++static int mt7987_2p5g_ext_mdc_mdio_funcs[] = {4, 4}; ++ ++static int mt7987_mdc_mdio_pins[] = {39, 40}; ++static int mt7987_mdc_mdio_funcs[] = {1, 1}; ++ ++/* spi */ ++static int mt7987_spi0_pins[] = {15, 16, 17, 18}; ++static int mt7987_spi0_funcs[] = {1, 1, 1, 1}; ++ ++static int mt7987_spi0_wp_hold_pins[] = {19, 20}; ++static int mt7987_spi0_wp_hold_funcs[] = {1, 1}; ++ ++static int mt7987_spi1_pins[] = {21, 22, 23, 24}; ++static int mt7987_spi1_funcs[] = {1, 1, 1, 1}; ++ ++static int mt7987_spi1_1_pins[] = {46, 47, 48, 49}; ++static int mt7987_spi1_1_funcs[] = {2, 2, 2, 2}; ++ ++static int mt7987_spi2_pins[] = {25, 26, 27, 28}; ++static int mt7987_spi2_funcs[] = {1, 1, 1, 1}; ++ ++static int mt7987_spi2_wp_hold_pins[] = {29, 30}; ++static int mt7987_spi2_wp_hold_funcs[] = {1, 1}; ++ ++/* emmc */ ++static int mt7987_emmc_45_pins[] = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; ++static int mt7987_emmc_45_funcs[] = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; ++ ++/* sd */ ++static int mt7987_sd_pins[] = {15, 16, 17, 18, 23, 24}; ++static int mt7987_sd_funcs[] = {2, 2, 2, 2, 2, 2}; ++ ++/* i2c */ ++static int mt7987_i2c0_0_pins[] = {29, 30}; ++static int mt7987_i2c0_0_funcs[] = {2, 2}; ++ ++static int mt7987_i2c0_1_pins[] = {39, 40}; ++static int mt7987_i2c0_1_funcs[] = {2, 2}; ++ ++static int mt7987_i2c0_2_pins[] = {43, 44}; ++static int mt7987_i2c0_2_funcs[] = {1, 1}; ++ ++/* pcie */ ++static int mt7987_pcie0_pereset_pins[] = {33}; ++static int mt7987_pcie0_pereset_funcs[] = {1}; ++ ++static int mt7987_pcie0_clkreq_pins[] = {34}; ++static int mt7987_pcie0_clkreq_funcs[] = {1}; ++ ++static int mt7987_pcie0_wake_pins[] = {35}; ++static int mt7987_pcie0_wake_funcs[] = {1}; ++ ++static int mt7987_pcie1_pereset_pins[] = {36}; ++static int mt7987_pcie1_pereset_funcs[] = {1}; ++ ++static int mt7987_pcie1_clkreq_pins[] = {37}; ++static int mt7987_pcie1_clkreq_funcs[] = {1}; ++ ++static int mt7987_pcie1_wake_pins[] = {38}; ++static int mt7987_pcie1_wake_funcs[] = {1}; ++ ++static int mt7987_pcie_phy_i2c_pins[] = {43, 44}; ++static int mt7987_pcie_phy_i2c_funcs[] = {3, 3}; ++ ++static const struct group_desc mt7987_groups[] = { ++ PINCTRL_PIN_GROUP("watchdog", mt7987_watchdog), ++ PINCTRL_PIN_GROUP("jtag", mt7987_jtag), ++ PINCTRL_PIN_GROUP("i2s", mt7987_i2s), ++ PINCTRL_PIN_GROUP("pcm", mt7987_pcm), ++ PINCTRL_PIN_GROUP("uart0", mt7987_uart0), ++ PINCTRL_PIN_GROUP("uart1_0", mt7987_uart1_0), ++ PINCTRL_PIN_GROUP("uart1_0_lite", mt7987_uart1_0_lite), ++ PINCTRL_PIN_GROUP("uart1_1", mt7987_uart1_1), ++ PINCTRL_PIN_GROUP("uart1_2", mt7987_uart1_2), ++ PINCTRL_PIN_GROUP("uart2_0", mt7987_uart2_0), ++ PINCTRL_PIN_GROUP("uart2_1", mt7987_uart2_1), ++ PINCTRL_PIN_GROUP("pwm0", mt7987_pwm0), ++ PINCTRL_PIN_GROUP("pwm1_0", mt7987_pwm1_0), ++ PINCTRL_PIN_GROUP("pwm1_1", mt7987_pwm1_1), ++ PINCTRL_PIN_GROUP("pwm2_0", mt7987_pwm2_0), ++ PINCTRL_PIN_GROUP("pwm2_1", mt7987_pwm2_1), ++ PINCTRL_PIN_GROUP("drv_vbus_p1", mt7987_drv_vbus_p1), ++ PINCTRL_PIN_GROUP("drv_vbus", mt7987_drv_vbus), ++ PINCTRL_PIN_GROUP("2p5gbe_led0", mt7987_2p5gbe_led0), ++ PINCTRL_PIN_GROUP("2p5gbe_led1_0", mt7987_2p5gbe_led1_0), ++ PINCTRL_PIN_GROUP("2p5gbe_led1_1", mt7987_2p5gbe_led1_1), ++ PINCTRL_PIN_GROUP("2p5g_ext_mdc_mdio", mt7987_2p5g_ext_mdc_mdio), ++ PINCTRL_PIN_GROUP("mdc_mdio", mt7987_mdc_mdio), ++ PINCTRL_PIN_GROUP("spi0", mt7987_spi0), ++ PINCTRL_PIN_GROUP("spi0_wp_hold", mt7987_spi0_wp_hold), ++ PINCTRL_PIN_GROUP("spi1", mt7987_spi1), ++ PINCTRL_PIN_GROUP("spi1_1", mt7987_spi1_1), ++ PINCTRL_PIN_GROUP("spi2", mt7987_spi2), ++ PINCTRL_PIN_GROUP("spi2_wp_hold", mt7987_spi2_wp_hold), ++ PINCTRL_PIN_GROUP("emmc_45", mt7987_emmc_45), ++ PINCTRL_PIN_GROUP("sd", mt7987_sd), ++ PINCTRL_PIN_GROUP("i2c0_0", mt7987_i2c0_0), ++ PINCTRL_PIN_GROUP("i2c0_1", mt7987_i2c0_1), ++ PINCTRL_PIN_GROUP("i2c0_2", mt7987_i2c0_2), ++ PINCTRL_PIN_GROUP("pcie0_pereset", mt7987_pcie0_pereset), ++ PINCTRL_PIN_GROUP("pcie0_clkreq", mt7987_pcie0_clkreq), ++ PINCTRL_PIN_GROUP("pcie0_wake", mt7987_pcie0_wake), ++ PINCTRL_PIN_GROUP("pcie1_pereset", mt7987_pcie1_pereset), ++ PINCTRL_PIN_GROUP("pcie1_clkreq", mt7987_pcie1_clkreq), ++ PINCTRL_PIN_GROUP("pcie1_wake", mt7987_pcie1_wake), ++ PINCTRL_PIN_GROUP("pcie1_pcie_phy_i2c", mt7987_pcie_phy_i2c), ++}; ++ ++static const char *const mt7987_audio_groups[] = {"i2s", "pcm",}; ++static const char *const mt7987_wdt_groups[] = {"watchdog",}; ++static const char *const mt7987_jtag_groups[] = {"jtag",}; ++static const char *const mt7987_uart_groups[] = {"uart0", "uart1_0", ++ "uart1_0_lite", "uart1_1", ++ "uart1_2", "uart2_0", ++ "uart2_1",}; ++static const char *const mt7987_pwm_groups[] = {"pwm0", "pwm1_0", "pwm1_1", "pwm2_0", ++ "pwm2_1",}; ++static const char *const mt7987_usb_groups[] = {"drv_vbus_p1", "drv_vbus",}; ++static const char *const mt7987_led_groups[] = {"2p5gbe_led0", "2p5gbe_led1_0", ++ "2p5gbe_led1_1",}; ++static const char *const mt7987_ethernet_groups[] = {"2p5g_ext_mdc_mdio", "mdc_mdio",}; ++static const char *const mt7987_spi_groups[] = {"spi0", "spi0_wp_hold", "spi1", ++ "spi1_1", "spi2", "spi2_wp_hold",}; ++static const char *const mt7987_flash_groups[] = {"emmc_45", "sd",}; ++static const char *const mt7987_i2c_groups[] = {"i2c0_0", "i2c0_1", "i2c0_2",}; ++static const char *const mt7987_pcie_groups[] = {"pcie_phy_i2c", "pcie0_pereset", ++ "pcie0_clkreq", "pcie0_wake", ++ "pcie1_pereset", "pcie1_clkreq", ++ "pcie1_wake",}; ++ ++ ++static const struct function_desc mt7987_functions[] = { ++ { {"audio", mt7987_audio_groups, ARRAY_SIZE(mt7987_audio_groups)}, NULL }, ++ { {"wdt", mt7987_wdt_groups, ARRAY_SIZE(mt7987_wdt_groups)}, NULL }, ++ { {"jtag", mt7987_jtag_groups, ARRAY_SIZE(mt7987_jtag_groups)}, NULL }, ++ { {"uart", mt7987_uart_groups, ARRAY_SIZE(mt7987_uart_groups)}, NULL }, ++ { {"pwm", mt7987_pwm_groups, ARRAY_SIZE(mt7987_pwm_groups)}, NULL }, ++ { {"usb", mt7987_usb_groups, ARRAY_SIZE(mt7987_usb_groups)}, NULL }, ++ { {"led", mt7987_led_groups, ARRAY_SIZE(mt7987_led_groups)}, NULL }, ++ { {"eth", mt7987_ethernet_groups, ARRAY_SIZE(mt7987_ethernet_groups)}, NULL }, ++ { {"spi", mt7987_spi_groups, ARRAY_SIZE(mt7987_spi_groups)}, NULL }, ++ { {"flash", mt7987_flash_groups, ARRAY_SIZE(mt7987_flash_groups)}, NULL }, ++ { {"i2c", mt7987_i2c_groups, ARRAY_SIZE(mt7987_i2c_groups)}, NULL }, ++ { {"pcie", mt7987_pcie_groups, ARRAY_SIZE(mt7987_pcie_groups)}, NULL }, ++}; ++ ++static const struct mtk_eint_hw mt7987_eint_hw = { ++ .port_mask = 7, ++ .ports = 7, ++ .ap_num = ARRAY_SIZE(mt7987_pins), ++ .db_cnt = 16, ++}; ++ ++static const char * const mt7987_pinctrl_register_base_names[] = { ++ "gpio", "iocfg_rb", "iocfg_lb", "iocfg_rt1", "iocfg_rt2", "iocfg_tl", ++}; ++ ++static struct mtk_pin_soc mt7987_data = { ++ .reg_cal = mt7987_reg_cals, ++ .pins = mt7987_pins, ++ .npins = ARRAY_SIZE(mt7987_pins), ++ .grps = mt7987_groups, ++ .ngrps = ARRAY_SIZE(mt7987_groups), ++ .funcs = mt7987_functions, ++ .nfuncs = ARRAY_SIZE(mt7987_functions), ++ .eint_hw = &mt7987_eint_hw, ++ .gpio_m = 0, ++ .ies_present = false, ++ .base_names = mt7987_pinctrl_register_base_names, ++ .nbase_names = ARRAY_SIZE(mt7987_pinctrl_register_base_names), ++ .bias_disable_set = mtk_pinconf_bias_disable_set, ++ .bias_disable_get = mtk_pinconf_bias_disable_get, ++ .bias_set = mtk_pinconf_bias_set, ++ .bias_get = mtk_pinconf_bias_get, ++ .pull_type = mt7987_pull_type, ++ .bias_set_combo = mtk_pinconf_bias_set_combo, ++ .bias_get_combo = mtk_pinconf_bias_get_combo, ++ .drive_set = mtk_pinconf_drive_set_rev1, ++ .drive_get = mtk_pinconf_drive_get_rev1, ++ .adv_pull_get = mtk_pinconf_adv_pull_get, ++ .adv_pull_set = mtk_pinconf_adv_pull_set, ++}; ++ ++static const struct of_device_id mt7987_pinctrl_of_match[] = { ++ { ++ .compatible = "mediatek,mt7987-pinctrl", ++ }, ++ {} ++}; ++ ++static int mt7987_pinctrl_probe(struct platform_device *pdev) ++{ ++ return mtk_moore_pinctrl_probe(pdev, &mt7987_data); ++} ++ ++static struct platform_driver mt7987_pinctrl_driver = { ++ .driver = { ++ .name = "mt7987-pinctrl", ++ .of_match_table = mt7987_pinctrl_of_match, ++ }, ++ .probe = mt7987_pinctrl_probe, ++}; ++ ++static int __init mt7987_pinctrl_init(void) ++{ ++ return platform_driver_register(&mt7987_pinctrl_driver); ++} ++arch_initcall(mt7987_pinctrl_init); diff --git a/lede/target/linux/mediatek/patches-6.12/361-clk-mediatek-add-mt7987-clock-drivers-support.patch b/lede/target/linux/mediatek/patches-6.12/361-clk-mediatek-add-mt7987-clock-drivers-support.patch new file mode 100644 index 0000000000..577b2b7dfc --- /dev/null +++ b/lede/target/linux/mediatek/patches-6.12/361-clk-mediatek-add-mt7987-clock-drivers-support.patch @@ -0,0 +1,1190 @@ +From 08b3847982f4c470ff1ac0761bed0d8d83f1fd49 Mon Sep 17 00:00:00 2001 +From: Sam Shih +Date: Mon, 20 Jan 2025 19:50:03 +0800 +Subject: [PATCH 2/2] clk: mediatek: add mt7987 clock drivers support + +Signed-off-by: Daniel Golle +--- + drivers/clk/mediatek/Kconfig | 9 + + drivers/clk/mediatek/Makefile | 5 + + drivers/clk/mediatek/clk-mt7987-apmixed.c | 116 +++++++ + drivers/clk/mediatek/clk-mt7987-eth.c | 94 +++++ + drivers/clk/mediatek/clk-mt7987-infracfg.c | 328 ++++++++++++++++++ + drivers/clk/mediatek/clk-mt7987-mcusys.c | 47 +++ + drivers/clk/mediatek/clk-mt7987-topckgen.c | 311 +++++++++++++++++ + .../dt-bindings/clock/mediatek,mt7987-clk.h | 206 +++++++++++ + .../reset/mediatek,mt7987-resets.h | 10 + + 9 files changed, 1126 insertions(+) + create mode 100644 drivers/clk/mediatek/clk-mt7987-apmixed.c + create mode 100644 drivers/clk/mediatek/clk-mt7987-eth.c + create mode 100644 drivers/clk/mediatek/clk-mt7987-infracfg.c + create mode 100644 drivers/clk/mediatek/clk-mt7987-mcusys.c + create mode 100644 drivers/clk/mediatek/clk-mt7987-topckgen.c + create mode 100644 include/dt-bindings/clock/mediatek,mt7987-clk.h + create mode 100644 include/dt-bindings/reset/mediatek,mt7987-resets.h + +--- a/drivers/clk/mediatek/Kconfig ++++ b/drivers/clk/mediatek/Kconfig +@@ -423,6 +423,15 @@ config COMMON_CLK_MT7986_ETHSYS + This driver adds support for clocks for Ethernet and SGMII + required on MediaTek MT7986 SoC. + ++config COMMON_CLK_MT7987 ++ tristate "Clock driver for MediaTek MT7987" ++ depends on ARCH_MEDIATEK || COMPILE_TEST ++ select COMMON_CLK_MEDIATEK ++ default ARCH_MEDIATEK ++ help ++ This driver supports MediaTek MT7987 basic clocks and clocks ++ required for various periperals found on this SoC. ++ + config COMMON_CLK_MT7988 + tristate "Clock driver for MediaTek MT7988" + depends on ARCH_MEDIATEK || COMPILE_TEST +--- a/drivers/clk/mediatek/Makefile ++++ b/drivers/clk/mediatek/Makefile +@@ -62,6 +62,11 @@ obj-$(CONFIG_COMMON_CLK_MT7986) += clk-m + obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-topckgen.o + obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-infracfg.o + obj-$(CONFIG_COMMON_CLK_MT7986_ETHSYS) += clk-mt7986-eth.o ++obj-$(CONFIG_COMMON_CLK_MT7987) += clk-mt7987-apmixed.o ++obj-$(CONFIG_COMMON_CLK_MT7987) += clk-mt7987-eth.o ++obj-$(CONFIG_COMMON_CLK_MT7987) += clk-mt7987-infracfg.o ++obj-$(CONFIG_COMMON_CLK_MT7987) += clk-mt7987-mcusys.o ++obj-$(CONFIG_COMMON_CLK_MT7987) += clk-mt7987-topckgen.o + obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-apmixed.o + obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-topckgen.o + obj-$(CONFIG_COMMON_CLK_MT7988) += clk-mt7988-infracfg.o +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7987-apmixed.c +@@ -0,0 +1,116 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "clk-mtk.h" ++#include "clk-gate.h" ++#include "clk-mux.h" ++#include "clk-pll.h" ++#include ++ ++#define MT7987_PLL_FMAX (2500UL * MHZ) ++#define MT7987_PCW_CHG_SHIFT 2 ++ ++#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ ++ _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ ++ _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg, _div_table, \ ++ _parent_name) \ ++ { \ ++ .id = _id, .name = _name, .reg = _reg, .pwr_reg = _pwr_reg, \ ++ .en_mask = _en_mask, .flags = _flags, \ ++ .rst_bar_mask = BIT(_rst_bar_mask), .fmax = MT7987_PLL_FMAX, \ ++ .pcwbits = _pcwbits, .pd_reg = _pd_reg, .pd_shift = _pd_shift, \ ++ .tuner_reg = _tuner_reg, .tuner_en_reg = _tuner_en_reg, \ ++ .tuner_en_bit = _tuner_en_bit, .pcw_reg = _pcw_reg, \ ++ .pcw_shift = _pcw_shift, .pcw_chg_reg = _pcw_chg_reg, \ ++ .pcw_chg_bit = MT7987_PCW_CHG_SHIFT, \ ++ .div_table = _div_table, .parent_name = _parent_name, \ ++ } ++ ++#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ ++ _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ ++ _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg, _parent_name) \ ++ PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, \ ++ _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \ ++ _tuner_en_bit, _pcw_reg, _pcw_shift, _pcw_chg_reg, NULL, \ ++ _parent_name) ++ ++static const struct mtk_pll_div_table mt7987_arm_ll_div[] = { ++ { .div = 0, .freq = 2000000000 }, ++ { .div = 1, .freq = 1500000000 }, ++ { .div = 2, .freq = 750000000 }, ++ { .div = 3, .freq = 375000000 }, ++ {} /* sentinel */ ++}; ++ ++static const struct mtk_pll_data plls[] = { ++ PLL(CLK_APMIXED_MPLL, "mpll", 0x0114, 0x0120, 0xff000001, HAVE_RST_BAR, ++ 23, 32, 0x0114, 4, 0, 0, 0, 0x0118, 0, 0x0114, "clkxtal"), ++ PLL(CLK_APMIXED_APLL2, "apll2", 0x0134, 0x0140, 0x00000001, 0, 0, 32, ++ 0x0134, 4, 0x0704, 0x0700, 1, 0x0138, 0, 0x0134, "clkxtal"), ++ PLL(CLK_APMIXED_NET1PLL, "net1pll", 0x0144, 0x0150, 0xff000001, ++ HAVE_RST_BAR | PLL_AO, 23, 32, 0x0144, 4, 0, 0, 0, 0x0148, 0, ++ 0x0144, "clkxtal"), ++ PLL(CLK_APMIXED_NET2PLL, "net2pll", 0x0154, 0x0160, 0xff000001, ++ HAVE_RST_BAR | PLL_AO, 23, 32, 0x0154, 4, 0, 0, 0, 0x0158, 0, ++ 0x0154, "clkxtal"), ++ PLL(CLK_APMIXED_WEDMCUPLL, "wedmcupll", 0x0164, 0x0170, 0x00000001, 0, ++ 0, 32, 0x0164, 4, 0, 0, 0, 0x0168, 0, 0x0164, "clkxtal"), ++ PLL(CLK_APMIXED_SGMPLL, "sgmpll", 0x0174, 0x0180, 0x00000001, 0, 0, 32, ++ 0x0174, 4, 0, 0, 0, 0x0178, 0, 0x0174, "clkxtal"), ++ PLL_B(CLK_APMIXED_ARM_LL, "arm_ll", 0x0104, 0x0110, 0x00000001, ++ PLL_AO, 0, 32, 0x0104, 4, 0, 0, 0, 0x0108, 0, 0x0104, ++ mt7987_arm_ll_div, "clkxtal"), ++ PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0124, 0x0130, 0x00000001, 0, 0, ++ 32, 0x0124, 4, 0, 0, 0, 0x0128, 0, 0x0124, "clkxtal"), ++}; ++ ++static const struct of_device_id of_match_clk_mt7987_apmixed[] = { ++ { .compatible = "mediatek,mt7987-apmixedsys" }, ++ { /* sentinel */ } ++}; ++ ++static int clk_mt7987_apmixed_probe(struct platform_device *pdev) ++{ ++ struct clk_hw_onecell_data *clk_data; ++ struct device_node *node = pdev->dev.of_node; ++ int r; ++ ++ clk_data = mtk_alloc_clk_data(ARRAY_SIZE(plls)); ++ if (!clk_data) ++ return -ENOMEM; ++ ++ r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); ++ if (r) ++ goto free_apmixed_data; ++ ++ r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); ++ if (r) ++ goto unregister_plls; ++ ++ return r; ++ ++unregister_plls: ++ mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); ++free_apmixed_data: ++ mtk_free_clk_data(clk_data); ++ return r; ++} ++ ++static struct platform_driver clk_mt7987_apmixed_drv = { ++ .probe = clk_mt7987_apmixed_probe, ++ .driver = { ++ .name = "mt7987-apmixedsys", ++ .of_match_table = of_match_clk_mt7987_apmixed, ++ }, ++}; ++builtin_platform_driver(clk_mt7987_apmixed_drv); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7987-eth.c +@@ -0,0 +1,94 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "clk-mtk.h" ++#include "clk-gate.h" ++#include ++ ++static const struct mtk_gate_regs ethdma_cg_regs = { ++ .set_ofs = 0x30, ++ .clr_ofs = 0x30, ++ .sta_ofs = 0x30, ++}; ++ ++#define GATE_ETHDMA(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = ðdma_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_no_setclr_inv, \ ++ } ++ ++static const struct mtk_gate ethdma_clks[] = { ++ GATE_ETHDMA(CLK_ETHDMA_FE_EN, "ethdma_fe_en", "netsys_2x_sel", 6), ++ GATE_ETHDMA(CLK_ETHDMA_GP2_EN, "ethdma_gp2_en", "netsys_500m_sel", 7), ++ GATE_ETHDMA(CLK_ETHDMA_GP1_EN, "ethdma_gp1_en", "netsys_500m_sel", 8), ++ GATE_ETHDMA(CLK_ETHDMA_GP3_EN, "ethdma_gp3_en", "netsys_500m_sel", 10), ++}; ++ ++static const struct mtk_clk_desc ethdma_desc = { ++ .clks = ethdma_clks, ++ .num_clks = ARRAY_SIZE(ethdma_clks), ++}; ++ ++static const struct mtk_gate_regs sgmii_cg_regs = { ++ .set_ofs = 0xe4, ++ .clr_ofs = 0xe4, ++ .sta_ofs = 0xe4, ++}; ++ ++#define GATE_SGMII(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = &sgmii_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_no_setclr_inv, \ ++ } ++ ++static const struct mtk_gate sgmii0_clks[] = { ++ GATE_SGMII(CLK_SGM0_TX_EN, "sgm0_tx_en", "clkxtal", 2), ++ GATE_SGMII(CLK_SGM0_RX_EN, "sgm0_rx_en", "clkxtal", 3), ++}; ++ ++static const struct mtk_clk_desc sgmii0_desc = { ++ .clks = sgmii0_clks, ++ .num_clks = ARRAY_SIZE(sgmii0_clks), ++}; ++ ++static const struct mtk_gate sgmii1_clks[] = { ++ GATE_SGMII(CLK_SGM1_TX_EN, "sgm1_tx_en", "clkxtal", 2), ++ GATE_SGMII(CLK_SGM1_RX_EN, "sgm1_rx_en", "clkxtal", 3), ++}; ++ ++static const struct mtk_clk_desc sgmii1_desc = { ++ .clks = sgmii1_clks, ++ .num_clks = ARRAY_SIZE(sgmii1_clks), ++}; ++ ++static const struct of_device_id of_match_clk_mt7987_eth[] = { ++ { .compatible = "mediatek,mt7987-ethsys", .data = ðdma_desc }, ++ { .compatible = "mediatek,mt7987-sgmiisys0", .data = &sgmii0_desc }, ++ { .compatible = "mediatek,mt7987-sgmiisys1", .data = &sgmii1_desc }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_match_clk_mt7987_eth); ++ ++static struct platform_driver clk_mt7987_eth_drv = { ++ .driver = { ++ .name = "clk-mt7987-eth", ++ .of_match_table = of_match_clk_mt7987_eth, ++ }, ++ .probe = mtk_clk_simple_probe, ++ .remove_new = mtk_clk_simple_remove, ++}; ++module_platform_driver(clk_mt7987_eth_drv); ++ ++MODULE_DESCRIPTION("MediaTek MT7987 Ethernet clocks driver"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7987-infracfg.c +@@ -0,0 +1,328 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "clk-mtk.h" ++#include "clk-mux.h" ++#include "clk-gate.h" ++#include ++#include ++ ++#define MT7987_INFRA_RST0_SET_OFFSET 0x70 ++#define MT7987_INFRA_RST1_SET_OFFSET 0x80 ++ ++static DEFINE_SPINLOCK(mt7987_clk_lock); ++ ++static const char *const infra_mux_uart0_parents[] = { "csw_infra_f26m_sel", ++ "infra_hf_66m_uart0_pck", ++ "uart_sel" }; ++ ++static const char *const infra_mux_uart1_parents[] = { "csw_infra_f26m_sel", ++ "infra_hf_66m_uart1_pck", ++ "uart_sel" }; ++ ++static const char *const infra_mux_uart2_parents[] = { "csw_infra_f26m_sel", ++ "infra_hf_66m_uart1_pck", ++ "uart_sel" }; ++ ++static const char *const infra_mux_spi0_parents[] = { ++ "i2c_sel", ++ "spi_sel" ++}; ++ ++static const char *const infra_mux_spi1_parents[] = { ++ "i2c_sel", ++ "spim_mst_sel" ++}; ++ ++static const char *const infra_mux_spi2_bck_parents[] = { ++ "i2c_sel", ++ "spi_sel" ++}; ++ ++static const char *const infra_pwm_bck_parents[] = { "cb_rtc_32p7k", ++ "csw_infra_f26m_sel", ++ "sysaxi_sel", "pwm_sel" }; ++ ++static const char *const infra_pcie_gfmux_tl_ck_o_p0_parents[] = { ++ "cb_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", ++ "pextp_tl_ck_sel" ++}; ++ ++static const char *const infra_pcie_gfmux_tl_ck_o_p1_parents[] = { ++ "cb_rtc_32p7k", "csw_infra_f26m_sel", "csw_infra_f26m_sel", ++ "pextp_tl_ck_p1_sel" ++}; ++ ++static struct mtk_mux infra_muxes[] = { ++ /* MODULE_CLK_SEL_0 */ ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel", ++ infra_mux_uart0_parents, 0x0018, 0x0010, 0x0014, ++ 0, 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART1_SEL, "infra_mux_uart1_sel", ++ infra_mux_uart1_parents, 0x0018, 0x0010, 0x0014, ++ 1, 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART2_SEL, "infra_mux_uart2_sel", ++ infra_mux_uart2_parents, 0x0018, 0x0010, 0x0014, ++ 2, 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI0_SEL, "infra_mux_spi0_sel", ++ infra_mux_spi0_parents, 0x0018, 0x0010, 0x0014, 4, ++ 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI1_SEL, "infra_mux_spi1_sel", ++ infra_mux_spi1_parents, 0x0018, 0x0010, 0x0014, 5, ++ 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_SPI2_BCK_SEL, ++ "infra_mux_spi2_bck_sel", ++ infra_mux_spi2_bck_parents, 0x0018, 0x0010, ++ 0x0014, 6, 1, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_PWM_BCK_SEL, "infra_pwm_bck_sel", ++ infra_pwm_bck_parents, 0x0018, 0x0010, 0x0014, 14, ++ 2, -1, -1, -1), ++ /* MODULE_CLK_SEL_1 */ ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P0_SEL, ++ "infra_pcie_gfmux_tl_ck_o_p0_sel", ++ infra_pcie_gfmux_tl_ck_o_p0_parents, 0x0028, ++ 0x0020, 0x0024, 0, 2, -1, -1, -1), ++ MUX_GATE_CLR_SET_UPD(CLK_INFRA_PCIE_GFMUX_TL_O_P1_SEL, ++ "infra_pcie_gfmux_tl_ck_o_p1_sel", ++ infra_pcie_gfmux_tl_ck_o_p1_parents, 0x0028, ++ 0x0020, 0x0024, 2, 2, -1, -1, -1), ++}; ++ ++static const struct mtk_gate_regs infra0_cg_regs = { ++ .set_ofs = 0x10, ++ .clr_ofs = 0x14, ++ .sta_ofs = 0x18, ++}; ++ ++static const struct mtk_gate_regs infra1_cg_regs = { ++ .set_ofs = 0x40, ++ .clr_ofs = 0x44, ++ .sta_ofs = 0x48, ++}; ++ ++static const struct mtk_gate_regs infra2_cg_regs = { ++ .set_ofs = 0x50, ++ .clr_ofs = 0x54, ++ .sta_ofs = 0x58, ++}; ++ ++static const struct mtk_gate_regs infra3_cg_regs = { ++ .set_ofs = 0x60, ++ .clr_ofs = 0x64, ++ .sta_ofs = 0x68, ++}; ++ ++#define GATE_INFRA0(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = &infra0_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_setclr, \ ++ } ++ ++#define GATE_INFRA1(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = &infra1_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_setclr, \ ++ } ++ ++#define GATE_INFRA2(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = &infra2_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_setclr, \ ++ } ++ ++#define GATE_INFRA3(_id, _name, _parent, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = &infra3_cg_regs, .shift = _shift, \ ++ .ops = &mtk_clk_gate_ops_setclr, \ ++ } ++ ++#define GATE_CRITICAL(_id, _name, _parent, _regs, _shift) \ ++ { \ ++ .id = _id, .name = _name, .parent_name = _parent, \ ++ .regs = _regs, .shift = _shift, .flags = CLK_IS_CRITICAL, \ ++ .ops = &mtk_clk_gate_ops_setclr, \ ++ } ++ ++static const struct mtk_gate infra_clks[] __initconst = { ++ /* INFRA1 */ ++ GATE_INFRA1(CLK_INFRA_66M_GPT_BCK, "infra_hf_66m_gpt_bck", ++ "sysaxi_sel", 0), ++ GATE_INFRA1(CLK_INFRA_66M_PWM_HCK, "infra_hf_66m_pwm_hck", ++ "sysaxi_sel", 1), ++ GATE_INFRA1(CLK_INFRA_66M_PWM_BCK, "infra_hf_66m_pwm_bck", ++ "infra_pwm_bck_sel", 2), ++ GATE_INFRA1(CLK_INFRA_133M_CQDMA_BCK, "infra_hf_133m_cqdma_bck", ++ "sysaxi_sel", 12), ++ GATE_INFRA1(CLK_INFRA_66M_AUD_SLV_BCK, "infra_66m_aud_slv_bck", ++ "sysaxi_sel", 13), ++ GATE_INFRA1(CLK_INFRA_AUD_26M, "infra_f_faud_26m", ++ "csw_infra_f26m_sel", 14), ++ GATE_INFRA1(CLK_INFRA_AUD_L, "infra_f_faud_l", "aud_l_sel", 15), ++ GATE_INFRA1(CLK_INFRA_AUD_AUD, "infra_f_aud_aud", "a1sys_sel", 16), ++ GATE_INFRA1(CLK_INFRA_AUD_EG2, "infra_f_faud_eg2", "a_tuner_sel", 18), ++ GATE_INFRA1(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", ++ "csw_infra_f26m_sel", 19), ++ GATE_CRITICAL(CLK_INFRA_133M_DBG_ACKM, "infra_hf_133m_dbg_ackm", ++ "sysaxi_sel", &infra1_cg_regs, 20), ++ GATE_INFRA1(CLK_INFRA_66M_AP_DMA_BCK, "infra_66m_ap_dma_bck", ++ "sysaxi_sel", 21), ++ GATE_INFRA1(CLK_INFRA_MSDC200_SRC, "infra_f_fmsdc200_src", ++ "emmc_200m_sel", 28), ++ GATE_CRITICAL(CLK_INFRA_66M_SEJ_BCK, "infra_hf_66m_sej_bck", ++ "sysaxi_sel", &infra1_cg_regs, 29), ++ GATE_CRITICAL(CLK_INFRA_PRE_CK_SEJ_F13M, "infra_pre_ck_sej_f13m", ++ "csw_infra_f26m_sel", &infra1_cg_regs, 30), ++ GATE_CRITICAL(CLK_INFRA_66M_TRNG, "infra_hf_66m_trng", "sysaxi_sel", ++ &infra1_cg_regs, 31), ++ /* INFRA2 */ ++ GATE_INFRA2(CLK_INFRA_26M_THERM_SYSTEM, "infra_hf_26m_therm_system", ++ "csw_infra_f26m_sel", 0), ++ GATE_INFRA2(CLK_INFRA_I2C_BCK, "infra_i2c_bck", "i2c_sel", 1), ++ GATE_INFRA2(CLK_INFRA_66M_UART0_PCK, "infra_hf_66m_uart0_pck", ++ "sysaxi_sel", 3), ++ GATE_INFRA2(CLK_INFRA_66M_UART1_PCK, "infra_hf_66m_uart1_pck", ++ "sysaxi_sel", 4), ++ GATE_INFRA2(CLK_INFRA_66M_UART2_PCK, "infra_hf_66m_uart2_pck", ++ "sysaxi_sel", 5), ++ GATE_INFRA2(CLK_INFRA_52M_UART0_CK, "infra_f_52m_uart0", ++ "infra_mux_uart0_sel", 3), ++ GATE_INFRA2(CLK_INFRA_52M_UART1_CK, "infra_f_52m_uart1", ++ "infra_mux_uart1_sel", 4), ++ GATE_INFRA2(CLK_INFRA_52M_UART2_CK, "infra_f_52m_uart2", ++ "infra_mux_uart2_sel", 5), ++ GATE_INFRA2(CLK_INFRA_NFI, "infra_f_fnfi", "nfi_sel", 9), ++ GATE_CRITICAL(CLK_INFRA_66M_NFI_HCK, "infra_hf_66m_nfi_hck", ++ "sysaxi_sel", &infra2_cg_regs, 11), ++ GATE_INFRA2(CLK_INFRA_104M_SPI0, "infra_hf_104m_spi0", ++ "infra_mux_spi0_sel", 12), ++ GATE_INFRA2(CLK_INFRA_104M_SPI1, "infra_hf_104m_spi1", ++ "infra_mux_spi1_sel", 13), ++ GATE_INFRA2(CLK_INFRA_104M_SPI2_BCK, "infra_hf_104m_spi2_bck", ++ "infra_mux_spi2_bck_sel", 14), ++ GATE_INFRA2(CLK_INFRA_66M_SPI0_HCK, "infra_hf_66m_spi0_hck", ++ "sysaxi_sel", 15), ++ GATE_INFRA2(CLK_INFRA_66M_SPI1_HCK, "infra_hf_66m_spi1_hck", ++ "sysaxi_sel", 16), ++ GATE_INFRA2(CLK_INFRA_66M_SPI2_HCK, "infra_hf_66m_spi2_hck", ++ "sysaxi_sel", 17), ++ GATE_INFRA2(CLK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", ++ "sysaxi_sel", 18), ++ GATE_CRITICAL(CLK_INFRA_RTC, "infra_f_frtc", "cb_rtc_32k", ++ &infra2_cg_regs, 19), ++ GATE_INFRA2(CLK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", ++ "csw_infra_f26m_sel", 20), ++ GATE_INFRA2(CLK_INFRA_RC_ADC, "infra_f_frc_adc", "infra_f_26m_adc_bck", ++ 21), ++ GATE_INFRA2(CLK_INFRA_MSDC400, "infra_f_fmsdc400", "emmc_400m_sel", ++ 22), ++ GATE_INFRA2(CLK_INFRA_MSDC2_HCK, "infra_f_fmsdc2_hck", "emmc_250m_sel", ++ 23), ++ GATE_INFRA2(CLK_INFRA_133M_MSDC_0_HCK, "infra_hf_133m_msdc_0_hck", ++ "sysaxi_sel", 24), ++ GATE_INFRA2(CLK_INFRA_66M_MSDC_0_HCK, "infra_66m_msdc_0_hck", ++ "sysaxi_sel", 25), ++ GATE_INFRA2(CLK_INFRA_133M_CPUM_BCK, "infra_hf_133m_cpum_bck", ++ "sysaxi_sel", 26), ++ GATE_INFRA2(CLK_INFRA_BIST2FPC, "infra_hf_fbist2fpc", "nfi_sel", 27), ++ GATE_INFRA2(CLK_INFRA_I2C_X16W_MCK_CK_P1, ++ "infra_hf_i2c_x16w_mck_ck_p1", "sysaxi_sel", 29), ++ GATE_INFRA2(CLK_INFRA_I2C_X16W_PCK_CK_P1, ++ "infra_hf_i2c_x16w_pck_ck_p1", "sysaxi_sel", 31), ++ /* INFRA3 */ ++ GATE_INFRA3(CLK_INFRA_133M_USB_HCK, "infra_133m_usb_hck", "sysaxi_sel", ++ 0), ++ GATE_INFRA3(CLK_INFRA_133M_USB_HCK_CK_P1, "infra_133m_usb_hck_ck_p1", ++ "sysaxi_sel", 1), ++ GATE_INFRA3(CLK_INFRA_66M_USB_HCK, "infra_66m_usb_hck", "sysaxi_sel", ++ 2), ++ GATE_INFRA3(CLK_INFRA_66M_USB_HCK_CK_P1, "infra_66m_usb_hck_ck_p1", ++ "sysaxi_sel", 3), ++ GATE_INFRA3(CLK_INFRA_USB_SYS_CK_P1, "infra_usb_sys_ck_p1", ++ "usb_sys_p1_sel", 5), ++ GATE_INFRA3(CLK_INFRA_USB_CK_P1, "infra_usb_ck_p1", "cb_cksq_40m", 7), ++ GATE_CRITICAL(CLK_INFRA_USB_FRMCNT_CK_P1, "infra_usb_frmcnt_ck_p1", ++ "cksq_40m_d2", &infra3_cg_regs, 9), ++ GATE_CRITICAL(CLK_INFRA_USB_PIPE_CK_P1, "infra_usb_pipe_ck_p1", ++ "usb_phy_sel", &infra3_cg_regs, 11), ++ GATE_INFRA3(CLK_INFRA_USB_UTMI_CK_P1, "infra_usb_utmi_ck_p1", ++ "clkxtal", 13), ++ GATE_INFRA3(CLK_INFRA_USB_XHCI_CK_P1, "infra_usb_xhci_ck_p1", ++ "usb_xhci_p1_sel", 15), ++ GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P0, "infra_pcie_gfmux_tl_ck_p0", ++ "infra_pcie_gfmux_tl_ck_o_p0_sel", 20), ++ GATE_INFRA3(CLK_INFRA_PCIE_GFMUX_TL_P1, "infra_pcie_gfmux_tl_ck_p1", ++ "infra_pcie_gfmux_tl_ck_o_p1_sel", 21), ++ GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P0, "infra_pcie_pipe_ck_p0", "clkxtal", ++ 24), ++ GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P1, "infra_pcie_pipe_ck_p1", "clkxtal", ++ 25), ++ GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P0, "infra_133m_pcie_ck_p0", ++ "sysaxi_sel", 28), ++ GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P1, "infra_133m_pcie_ck_p1", ++ "sysaxi_sel", 29), ++ /* INFRA0 */ ++ GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P0, ++ "infra_pcie_peri_ck_26m_ck_p0", "csw_infra_f26m_sel", 7), ++ GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P1, ++ "infra_pcie_peri_ck_26m_ck_p1", "csw_infra_f26m_sel", 8), ++}; ++ ++static u16 infra_rst_ofs[] = { ++ MT7987_INFRA_RST0_SET_OFFSET, ++ MT7987_INFRA_RST1_SET_OFFSET, ++}; ++ ++static u16 infra_idx_map[] = { ++ [MT7987_INFRA_RST0_PEXTP_MAC_SWRST] = 0 * RST_NR_PER_BANK + 6, ++ [MT7987_INFRA_RST1_THERM_CTRL_SWRST] = 1 * RST_NR_PER_BANK + 9, ++}; ++ ++static struct mtk_clk_rst_desc infra_rst_desc = { ++ .version = MTK_RST_SET_CLR, ++ .rst_bank_ofs = infra_rst_ofs, ++ .rst_bank_nr = ARRAY_SIZE(infra_rst_ofs), ++ .rst_idx_map = infra_idx_map, ++ .rst_idx_map_nr = ARRAY_SIZE(infra_idx_map), ++}; ++ ++static const struct mtk_clk_desc infra_desc = { ++ .clks = infra_clks, ++ .num_clks = ARRAY_SIZE(infra_clks), ++ .mux_clks = infra_muxes, ++ .num_mux_clks = ARRAY_SIZE(infra_muxes), ++ .clk_lock = &mt7987_clk_lock, ++ .rst_desc = &infra_rst_desc, ++}; ++ ++static const struct of_device_id of_match_clk_mt7987_infracfg[] = { ++ { .compatible = "mediatek,mt7987-infracfg", .data = &infra_desc }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_match_clk_mt7987_infracfg); ++ ++static struct platform_driver clk_mt7987_infracfg_drv = { ++ .driver = { ++ .name = "clk-mt7987-infracfg", ++ .of_match_table = of_match_clk_mt7987_infracfg, ++ }, ++ .probe = mtk_clk_simple_probe, ++ .remove_new = mtk_clk_simple_remove, ++}; ++module_platform_driver(clk_mt7987_infracfg_drv); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7987-mcusys.c +@@ -0,0 +1,47 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "clk-mtk.h" ++#include "clk-gate.h" ++#include "clk-mux.h" ++#include ++ ++static DEFINE_SPINLOCK(mt7987_clk_lock); ++static const char *const mcu_bus_div_parents[] = { "cb_cksq_40m", "arm_ll" }; ++ ++static struct mtk_composite mcu_muxes[] = { ++ MUX_GATE_FLAGS(CLK_MCU_BUS_DIV_SEL, "mcu_bus_div_sel", ++ mcu_bus_div_parents, 0x7C0, 9, 1, -1, CLK_IS_CRITICAL), ++}; ++ ++static const struct mtk_clk_desc mcusys_desc = { ++ .composite_clks = mcu_muxes, ++ .num_composite_clks = ARRAY_SIZE(mcu_muxes), ++ .clk_lock = &mt7987_clk_lock, ++}; ++ ++static const struct of_device_id of_match_clk_mt7987_mcusys[] = { ++ { .compatible = "mediatek,mt7987-mcusys", .data = &mcusys_desc }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_match_clk_mt7987_mcusys); ++ ++static struct platform_driver clk_mt7987_mcusys_drv = { ++ .driver = { ++ .name = "clk-mt7987-mcusys", ++ .of_match_table = of_match_clk_mt7987_mcusys, ++ }, ++ .probe = mtk_clk_simple_probe, ++ .remove_new = mtk_clk_simple_remove, ++}; ++module_platform_driver(clk_mt7987_mcusys_drv); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/clk/mediatek/clk-mt7987-topckgen.c +@@ -0,0 +1,311 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "clk-mtk.h" ++#include "clk-gate.h" ++#include "clk-mux.h" ++#include ++ ++static DEFINE_SPINLOCK(mt7987_clk_lock); ++ ++static const struct mtk_fixed_factor top_divs[] __initconst = { ++ FACTOR(CLK_TOP_CB_M_D2, "cb_m_d2", "mpll", 1, 2), ++ FACTOR(CLK_TOP_CB_M_D3, "cb_m_d3", "mpll", 1, 3), ++ FACTOR(CLK_TOP_M_D3_D2, "m_d3_d2", "mpll", 1, 6), ++ FACTOR(CLK_TOP_CB_M_D4, "cb_m_d4", "mpll", 1, 4), ++ FACTOR(CLK_TOP_CB_M_D8, "cb_m_d8", "mpll", 1, 8), ++ FACTOR(CLK_TOP_M_D8_D2, "m_d8_d2", "mpll", 1, 16), ++ FACTOR(CLK_TOP_CB_APLL2_D4, "cb_apll2_d4", "apll2", 1, 4), ++ FACTOR(CLK_TOP_CB_NET1_D3, "cb_net1_d3", "net1pll", 1, 3), ++ FACTOR(CLK_TOP_CB_NET1_D4, "cb_net1_d4", "net1pll", 1, 4), ++ FACTOR(CLK_TOP_CB_NET1_D5, "cb_net1_d5", "net1pll", 1, 5), ++ FACTOR(CLK_TOP_NET1_D5_D2, "net1_d5_d2", "net1pll", 1, 10), ++ FACTOR(CLK_TOP_NET1_D5_D4, "net1_d5_d4", "net1pll", 1, 20), ++ FACTOR(CLK_TOP_CB_NET1_D7, "cb_net1_d7", "net1pll", 1, 7), ++ FACTOR(CLK_TOP_NET1_D7_D2, "net1_d7_d2", "net1pll", 1, 14), ++ FACTOR(CLK_TOP_NET1_D7_D4, "net1_d7_d4", "net1pll", 1, 28), ++ FACTOR(CLK_TOP_NET1_D8_D2, "net1_d8_d2", "net1pll", 1, 16), ++ FACTOR(CLK_TOP_NET1_D8_D4, "net1_d8_d4", "net1pll", 1, 32), ++ FACTOR(CLK_TOP_NET1_D8_D8, "net1_d8_d8", "net1pll", 1, 64), ++ FACTOR(CLK_TOP_NET1_D8_D16, "net1_d8_d16", "net1pll", 1, 128), ++ FACTOR(CLK_TOP_CB_NET2_D2, "cb_net2_d2", "net2pll", 1, 2), ++ FACTOR(CLK_TOP_CB_NET2_D4, "cb_net2_d4", "net2pll", 1, 4), ++ FACTOR(CLK_TOP_NET2_D4_D4, "net2_d4_d4", "net2pll", 1, 16), ++ FACTOR(CLK_TOP_NET2_D4_D8, "net2_d4_d8", "net2pll", 1, 32), ++ FACTOR(CLK_TOP_CB_NET2_D6, "cb_net2_d6", "net2pll", 1, 6), ++ FACTOR(CLK_TOP_NET2_D7_D2, "net2_d7_d2", "net2pll", 1, 14), ++ FACTOR(CLK_TOP_CB_NET2_D8, "cb_net2_d8", "net2pll", 1, 8), ++ FACTOR(CLK_TOP_MSDC_D2, "msdc_d2", "msdcpll", 1, 2), ++ FACTOR(CLK_TOP_CB_CKSQ_40M, "cb_cksq_40m", "clkxtal", 1, 1), ++ FACTOR(CLK_TOP_CKSQ_40M_D2, "cksq_40m_d2", "cb_cksq_40m", 1, 2), ++ FACTOR(CLK_TOP_CB_RTC_32K, "cb_rtc_32k", "cb_cksq_40m", 1, 1250), ++ FACTOR(CLK_TOP_CB_RTC_32P7K, "cb_rtc_32p7k", "cb_cksq_40m", 1, 1221), ++}; ++ ++static const char *const netsys_parents[] = { "cb_cksq_40m", "cb_net2_d2" }; ++ ++static const char *const netsys_500m_parents[] = { "cb_cksq_40m", "cb_net1_d5", ++ "net1_d5_d2" }; ++ ++static const char *const netsys_2x_parents[] = { "cb_cksq_40m", "net2pll" }; ++ ++static const char *const eth_gmii_parents[] = { "cb_cksq_40m", "net1_d5_d4" }; ++ ++static const char *const eip_parents[] = { "cb_cksq_40m", "cb_net1_d3", ++ "net2pll", "cb_net1_d4", ++ "cb_net1_d5" }; ++ ++static const char *const axi_infra_parents[] = { "cb_cksq_40m", "net1_d8_d2" }; ++ ++static const char *const uart_parents[] = { "cb_cksq_40m", "cb_m_d8", ++ "m_d8_d2" }; ++ ++static const char *const emmc_250m_parents[] = { "cb_cksq_40m", "net1_d5_d2", ++ "net1_d7_d2" }; ++ ++static const char *const emmc_400m_parents[] = { "cb_cksq_40m", "msdcpll", ++ "cb_net1_d7", "cb_m_d2", ++ "net1_d7_d2", "cb_net2_d6" }; ++ ++static const char *const spi_parents[] = { "cb_cksq_40m", "cb_m_d2", ++ "net1_d7_d2", "net1_d8_d2", ++ "cb_net2_d6", "net1_d5_d4", ++ "cb_m_d4", "net1_d8_d4" }; ++ ++static const char *const nfi_parents[] = { ++ "cksq_40m_d2", "net1_d8_d2", "cb_m_d3", "net1_d5_d4", "cb_m_d4", ++ "net1_d7_d4", "net1_d8_d4", "m_d3_d2", "net2_d7_d2", "cb_m_d8" ++}; ++ ++static const char *const pwm_parents[] = { "cb_cksq_40m", "net1_d8_d2", ++ "net1_d5_d4", "cb_m_d4", ++ "m_d8_d2", "cb_rtc_32k" }; ++ ++static const char *const i2c_parents[] = { "cb_cksq_40m", "net1_d5_d4", ++ "cb_m_d4", "net1_d8_d4" }; ++ ++static const char *const pcie_mbist_250m_parents[] = { "cb_cksq_40m", ++ "net1_d5_d2" }; ++ ++static const char *const pextp_tl_ck_parents[] = { "cb_cksq_40m", "cb_net2_d6", ++ "net1_d7_d4", "m_d8_d2", ++ "cb_rtc_32k" }; ++ ++static const char *const aud_parents[] = { "cb_cksq_40m", "apll2" }; ++ ++static const char *const a1sys_parents[] = { "cb_cksq_40m", "cb_apll2_d4" }; ++ ++static const char *const aud_l_parents[] = { "cb_cksq_40m", "apll2", ++ "m_d8_d2" }; ++ ++static const char *const usb_phy_parents[] = { "cksq_40m_d2", "m_d8_d2" }; ++ ++static const char *const sgm_0_parents[] = { "cb_cksq_40m", "sgmpll" }; ++ ++static const char *const sgm_sbus_0_parents[] = { "cb_cksq_40m", ++ "net1_d8_d4" }; ++ ++static const char *const sysapb_parents[] = { "cb_cksq_40m", "m_d3_d2" }; ++ ++static const char *const eth_refck_50m_parents[] = { "cb_cksq_40m", ++ "net2_d4_d4" }; ++ ++static const char *const eth_sys_200m_parents[] = { "cb_cksq_40m", ++ "cb_net2_d4" }; ++ ++static const char *const eth_xgmii_parents[] = { "cksq_40m_d2", "net1_d8_d8", ++ "net1_d8_d16" }; ++ ++static const char *const dramc_md32_parents[] = { "cb_cksq_40m", "cb_m_d2", ++ "wedmcupll" }; ++ ++static const char *const da_xtp_glb_p0_parents[] = { "cb_cksq_40m", ++ "cb_net2_d8" }; ++ ++static const char *const da_ckm_xtal_parents[] = { "cb_cksq_40m", "m_d8_d2" }; ++ ++static const char *const eth_mii_parents[] = { "cksq_40m_d2", "net2_d4_d8" }; ++ ++static const char *const emmc_200m_parents[] = { "cb_cksq_40m", "msdc_d2", ++ "net1_d7_d2", "cb_net2_d6", ++ "net1_d7_d4" }; ++ ++static struct mtk_mux top_muxes[] = { ++ /* CLK_CFG_0 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_SEL, "netsys_sel", netsys_parents, ++ 0x000, 0x004, 0x008, 0, 1, 7, 0x1C0, 0), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_500M_SEL, "netsys_500m_sel", ++ netsys_500m_parents, 0x000, 0x004, 0x008, 8, 2, ++ 15, 0x1C0, 1), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_2X_SEL, "netsys_2x_sel", ++ netsys_2x_parents, 0x000, 0x004, 0x008, 16, 1, 23, ++ 0x1C0, 2), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_GMII_SEL, "eth_gmii_sel", ++ eth_gmii_parents, 0x000, 0x004, 0x008, 24, 1, 31, ++ 0x1C0, 3), ++ /* CLK_CFG_1 */ ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EIP_SEL, "eip_sel", eip_parents, ++ 0x010, 0x014, 0x018, 0, 3, 7, 0x1C0, 4, ++ CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_INFRA_SEL, "axi_infra_sel", ++ axi_infra_parents, 0x010, 0x014, 0x018, 8, ++ 1, 15, 0x1C0, 5, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_UART_SEL, "uart_sel", uart_parents, 0x010, ++ 0x014, 0x018, 16, 2, 23, 0x1C0, 6), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_250M_SEL, "emmc_250m_sel", ++ emmc_250m_parents, 0x010, 0x014, 0x018, 24, 2, 31, ++ 0x1C0, 7), ++ /* CLK_CFG_2 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_400M_SEL, "emmc_400m_sel", ++ emmc_400m_parents, 0x020, 0x024, 0x028, 0, 3, 7, ++ 0x1C0, 8), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x020, ++ 0x024, 0x028, 8, 3, 15, 0x1C0, 9), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_SPIM_MST_SEL, "spim_mst_sel", spi_parents, ++ 0x020, 0x024, 0x028, 16, 3, 23, 0x1C0, 10), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_NFI_SEL, "nfi_sel", nfi_parents, 0x020, ++ 0x024, 0x028, 24, 4, 31, 0x1C0, 11), ++ /* CLK_CFG_3 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x030, ++ 0x034, 0x038, 0, 3, 7, 0x1C0, 12), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x030, ++ 0x034, 0x038, 8, 2, 15, 0x1C0, 13), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_PCIE_MBIST_250M_SEL, ++ "pcie_mbist_250m_sel", pcie_mbist_250m_parents, ++ 0x030, 0x034, 0x038, 16, 1, 23, 0x1C0, 14), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_SEL, "pextp_tl_ck_sel", ++ pextp_tl_ck_parents, 0x030, 0x034, 0x038, 24, 3, ++ 31, 0x1C0, 15), ++ /* CLK_CFG_4 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_P1_SEL, "pextp_tl_ck_p1_sel", ++ pextp_tl_ck_parents, 0x040, 0x044, 0x048, 0, 3, 7, ++ 0x1C0, 16), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_SYS_P1_SEL, "usb_sys_p1_sel", ++ eth_gmii_parents, 0x040, 0x044, 0x048, 8, 1, 15, ++ 0x1C0, 17), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_XHCI_P1_SEL, "usb_xhci_p1_sel", ++ eth_gmii_parents, 0x040, 0x044, 0x048, 16, 1, 23, ++ 0x1C0, 18), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_SEL, "aud_sel", aud_parents, 0x040, ++ 0x044, 0x048, 24, 1, 31, 0x1C0, 19), ++ /* CLK_CFG_5 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_A1SYS_SEL, "a1sys_sel", a1sys_parents, ++ 0x050, 0x054, 0x058, 0, 1, 7, 0x1C0, 20), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_L_SEL, "aud_l_sel", aud_l_parents, ++ 0x050, 0x054, 0x058, 8, 2, 15, 0x1C0, 21), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_A_TUNER_SEL, "a_tuner_sel", a1sys_parents, ++ 0x050, 0x054, 0x058, 16, 1, 23, 0x1C0, 22), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_PHY_SEL, "usb_phy_sel", ++ usb_phy_parents, 0x050, 0x054, 0x058, 24, 1, 31, ++ 0x1C0, 23), ++ /* CLK_CFG_6 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_SGM_0_SEL, "sgm_0_sel", sgm_0_parents, ++ 0x060, 0x064, 0x068, 0, 1, 7, 0x1C0, 24), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SGM_SBUS_0_SEL, "sgm_sbus_0_sel", ++ sgm_sbus_0_parents, 0x060, 0x064, 0x068, 8, ++ 1, 15, 0x1C0, 25, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_SGM_1_SEL, "sgm_1_sel", sgm_0_parents, ++ 0x060, 0x064, 0x068, 16, 1, 23, 0x1C0, 26), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SGM_SBUS_1_SEL, "sgm_sbus_1_sel", ++ sgm_sbus_0_parents, 0x060, 0x064, 0x068, 24, ++ 1, 31, 0x1C0, 27, CLK_IS_CRITICAL), ++ /* CLK_CFG_7 */ ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAXI_SEL, "sysaxi_sel", ++ axi_infra_parents, 0x070, 0x074, 0x078, 0, ++ 1, 7, 0x1C0, 28, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAPB_SEL, "sysapb_sel", ++ sysapb_parents, 0x070, 0x074, 0x078, 8, 1, ++ 15, 0x1C0, 29, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_REFCK_50M_SEL, "eth_refck_50m_sel", ++ eth_refck_50m_parents, 0x070, 0x074, 0x078, 16, 1, ++ 23, 0x1C0, 30), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_SYS_200M_SEL, "eth_sys_200m_sel", ++ eth_sys_200m_parents, 0x070, 0x074, 0x078, 24, 1, ++ 31, 0x1C4, 0), ++ /* CLK_CFG_8 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_SYS_SEL, "eth_sys_sel", ++ pcie_mbist_250m_parents, 0x080, 0x084, 0x088, 0, ++ 1, 7, 0x1C4, 1), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_XGMII_SEL, "eth_xgmii_sel", ++ eth_xgmii_parents, 0x080, 0x084, 0x088, 8, 2, 15, ++ 0x1C4, 2), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_SEL, "dramc_sel", ++ usb_phy_parents, 0x080, 0x084, 0x088, 16, 1, ++ 23, 0x1C4, 3, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_MD32_SEL, "dramc_md32_sel", ++ dramc_md32_parents, 0x080, 0x084, 0x088, 24, ++ 2, 31, 0x1C4, 4, CLK_IS_CRITICAL), ++ /* CLK_CFG_9 */ ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_INFRA_F26M_SEL, ++ "csw_infra_f26m_sel", usb_phy_parents, ++ 0x090, 0x094, 0x098, 0, 1, 7, 0x1C4, 5, ++ CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_PEXTP_P0_SEL, "pextp_p0_sel", ++ usb_phy_parents, 0x090, 0x094, 0x098, 8, 1, ++ 15, 0x1C4, 6, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_PEXTP_P1_SEL, "pextp_p1_sel", ++ usb_phy_parents, 0x090, 0x094, 0x098, 16, 1, ++ 23, 0x1C4, 7, CLK_IS_CRITICAL), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P0_SEL, "da_xtp_glb_p0_sel", ++ da_xtp_glb_p0_parents, 0x090, 0x094, 0x098, 24, 1, ++ 31, 0x1C4, 8), ++ /* CLK_CFG_10 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_XTP_GLB_P1_SEL, "da_xtp_glb_p1_sel", ++ da_xtp_glb_p0_parents, 0x0A0, 0x0A4, 0x0A8, 0, 1, ++ 7, 0x1C4, 9), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_CKM_SEL, "ckm_sel", usb_phy_parents, ++ 0x0A0, 0x0A4, 0x0A8, 8, 1, 15, 0x1C4, 10), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_CKM_XTAL_SEL, "da_ckm_xtal_sel", ++ da_ckm_xtal_parents, 0x0A0, 0x0A4, 0x0A8, 16, 1, ++ 23, 0x1C4, 11), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_SEL, "pextp_sel", usb_phy_parents, ++ 0x0A0, 0x0A4, 0x0A8, 24, 1, 31, 0x1C4, 12), ++ /* CLK_CFG_11 */ ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_ETH_MII_SEL, "eth_mii_sel", ++ eth_mii_parents, 0x0B0, 0x0B4, 0x0B8, 0, 1, 7, ++ 0x1C4, 13), ++ MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_200M_SEL, "emmc_200m_sel", ++ emmc_200m_parents, 0x0B0, 0x0B4, 0x0B8, 8, 3, 15, ++ 0x1C4, 14), ++}; ++ ++static const struct mtk_composite top_adj_divs[] = { ++ DIV_GATE(CLK_TOP_AUD_I2S_M, "aud_i2s_m", "aud_sel", 0x0420, 0, 0x0420, ++ 8, 8), ++}; ++ ++static const struct mtk_clk_desc topck_desc = { ++ .factor_clks = top_divs, ++ .num_factor_clks = ARRAY_SIZE(top_divs), ++ .mux_clks = top_muxes, ++ .num_mux_clks = ARRAY_SIZE(top_muxes), ++ .composite_clks = top_adj_divs, ++ .num_composite_clks = ARRAY_SIZE(top_adj_divs), ++ .clk_lock = &mt7987_clk_lock, ++}; ++ ++static const struct of_device_id of_match_clk_mt7987_topckgen[] = { ++ { .compatible = "mediatek,mt7987-topckgen", .data = &topck_desc }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_match_clk_mt7987_topckgen); ++ ++static struct platform_driver clk_mt7987_topckgen_drv = { ++ .probe = mtk_clk_simple_probe, ++ .remove_new = mtk_clk_simple_remove, ++ .driver = { ++ .name = "clk-mt7987-topckgen", ++ .of_match_table = of_match_clk_mt7987_topckgen, ++ }, ++}; ++module_platform_driver(clk_mt7987_topckgen_drv); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/include/dt-bindings/clock/mediatek,mt7987-clk.h +@@ -0,0 +1,206 @@ ++/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ ++/* ++ * Copyright (c) 2024 MediaTek Inc. ++ * Author: Lu Tang ++ * Author: Sam Shih ++ */ ++ ++#ifndef _DT_BINDINGS_CLK_MT7987_H ++#define _DT_BINDINGS_CLK_MT7987_H ++ ++/* INFRACFG */ ++ ++#define CLK_INFRA_MUX_UART0_SEL 0 ++#define CLK_INFRA_MUX_UART1_SEL 1 ++#define CLK_INFRA_MUX_UART2_SEL 2 ++#define CLK_INFRA_MUX_SPI0_SEL 3 ++#define CLK_INFRA_MUX_SPI1_SEL 4 ++#define CLK_INFRA_MUX_SPI2_BCK_SEL 5 ++#define CLK_INFRA_PWM_BCK_SEL 6 ++#define CLK_INFRA_PCIE_GFMUX_TL_O_P0_SEL 7 ++#define CLK_INFRA_PCIE_GFMUX_TL_O_P1_SEL 8 ++#define CLK_INFRA_66M_GPT_BCK 9 ++#define CLK_INFRA_66M_PWM_HCK 10 ++#define CLK_INFRA_66M_PWM_BCK 11 ++#define CLK_INFRA_133M_CQDMA_BCK 12 ++#define CLK_INFRA_66M_AUD_SLV_BCK 13 ++#define CLK_INFRA_AUD_26M 14 ++#define CLK_INFRA_AUD_L 15 ++#define CLK_INFRA_AUD_AUD 16 ++#define CLK_INFRA_AUD_EG2 17 ++#define CLK_INFRA_DRAMC_F26M 18 ++#define CLK_INFRA_133M_DBG_ACKM 19 ++#define CLK_INFRA_66M_AP_DMA_BCK 20 ++#define CLK_INFRA_MSDC200_SRC 21 ++#define CLK_INFRA_66M_SEJ_BCK 22 ++#define CLK_INFRA_PRE_CK_SEJ_F13M 23 ++#define CLK_INFRA_66M_TRNG 24 ++#define CLK_INFRA_26M_THERM_SYSTEM 25 ++#define CLK_INFRA_I2C_BCK 26 ++#define CLK_INFRA_66M_UART0_PCK 27 ++#define CLK_INFRA_66M_UART1_PCK 28 ++#define CLK_INFRA_66M_UART2_PCK 29 ++#define CLK_INFRA_52M_UART0_CK 30 ++#define CLK_INFRA_52M_UART1_CK 31 ++#define CLK_INFRA_52M_UART2_CK 32 ++#define CLK_INFRA_NFI 33 ++#define CLK_INFRA_66M_NFI_HCK 34 ++#define CLK_INFRA_104M_SPI0 35 ++#define CLK_INFRA_104M_SPI1 36 ++#define CLK_INFRA_104M_SPI2_BCK 37 ++#define CLK_INFRA_66M_SPI0_HCK 38 ++#define CLK_INFRA_66M_SPI1_HCK 39 ++#define CLK_INFRA_66M_SPI2_HCK 40 ++#define CLK_INFRA_66M_FLASHIF_AXI 41 ++#define CLK_INFRA_RTC 42 ++#define CLK_INFRA_26M_ADC_BCK 43 ++#define CLK_INFRA_RC_ADC 44 ++#define CLK_INFRA_MSDC400 45 ++#define CLK_INFRA_MSDC2_HCK 46 ++#define CLK_INFRA_133M_MSDC_0_HCK 47 ++#define CLK_INFRA_66M_MSDC_0_HCK 48 ++#define CLK_INFRA_133M_CPUM_BCK 49 ++#define CLK_INFRA_BIST2FPC 50 ++#define CLK_INFRA_I2C_X16W_MCK_CK_P1 51 ++#define CLK_INFRA_I2C_X16W_PCK_CK_P1 52 ++#define CLK_INFRA_133M_USB_HCK 53 ++#define CLK_INFRA_133M_USB_HCK_CK_P1 54 ++#define CLK_INFRA_66M_USB_HCK 55 ++#define CLK_INFRA_66M_USB_HCK_CK_P1 56 ++#define CLK_INFRA_USB_SYS_CK_P1 57 ++#define CLK_INFRA_USB_CK_P1 58 ++#define CLK_INFRA_USB_FRMCNT_CK_P1 59 ++#define CLK_INFRA_USB_PIPE_CK_P1 60 ++#define CLK_INFRA_USB_UTMI_CK_P1 61 ++#define CLK_INFRA_USB_XHCI_CK_P1 62 ++#define CLK_INFRA_PCIE_GFMUX_TL_P0 63 ++#define CLK_INFRA_PCIE_GFMUX_TL_P1 64 ++#define CLK_INFRA_PCIE_PIPE_P0 65 ++#define CLK_INFRA_PCIE_PIPE_P1 66 ++#define CLK_INFRA_133M_PCIE_CK_P0 67 ++#define CLK_INFRA_133M_PCIE_CK_P1 68 ++#define CLK_INFRA_PCIE_PERI_26M_CK_P0 69 ++#define CLK_INFRA_PCIE_PERI_26M_CK_P1 70 ++#define CLK_INFRA_NR_CLK 71 ++ ++/* TOPCKGEN */ ++ ++#define CLK_TOP_CB_M_D2 0 ++#define CLK_TOP_CB_M_D3 1 ++#define CLK_TOP_M_D3_D2 2 ++#define CLK_TOP_CB_M_D4 3 ++#define CLK_TOP_CB_M_D8 4 ++#define CLK_TOP_M_D8_D2 5 ++#define CLK_TOP_CB_APLL2_D4 6 ++#define CLK_TOP_CB_NET1_D3 7 ++#define CLK_TOP_CB_NET1_D4 8 ++#define CLK_TOP_CB_NET1_D5 9 ++#define CLK_TOP_NET1_D5_D2 10 ++#define CLK_TOP_NET1_D5_D4 11 ++#define CLK_TOP_CB_NET1_D7 12 ++#define CLK_TOP_NET1_D7_D2 13 ++#define CLK_TOP_NET1_D7_D4 14 ++#define CLK_TOP_NET1_D8_D2 15 ++#define CLK_TOP_NET1_D8_D4 16 ++#define CLK_TOP_NET1_D8_D8 17 ++#define CLK_TOP_NET1_D8_D16 18 ++#define CLK_TOP_CB_NET2_D2 19 ++#define CLK_TOP_CB_NET2_D4 20 ++#define CLK_TOP_NET2_D4_D4 21 ++#define CLK_TOP_NET2_D4_D8 22 ++#define CLK_TOP_CB_NET2_D6 23 ++#define CLK_TOP_NET2_D7_D2 24 ++#define CLK_TOP_CB_NET2_D8 25 ++#define CLK_TOP_MSDC_D2 26 ++#define CLK_TOP_CB_CKSQ_40M 27 ++#define CLK_TOP_CKSQ_40M_D2 28 ++#define CLK_TOP_CB_RTC_32K 29 ++#define CLK_TOP_CB_RTC_32P7K 30 ++#define CLK_TOP_NETSYS_SEL 31 ++#define CLK_TOP_NETSYS_500M_SEL 32 ++#define CLK_TOP_NETSYS_2X_SEL 33 ++#define CLK_TOP_ETH_GMII_SEL 34 ++#define CLK_TOP_EIP_SEL 35 ++#define CLK_TOP_AXI_INFRA_SEL 36 ++#define CLK_TOP_UART_SEL 37 ++#define CLK_TOP_EMMC_250M_SEL 38 ++#define CLK_TOP_EMMC_400M_SEL 39 ++#define CLK_TOP_SPI_SEL 40 ++#define CLK_TOP_SPIM_MST_SEL 41 ++#define CLK_TOP_NFI_SEL 42 ++#define CLK_TOP_PWM_SEL 43 ++#define CLK_TOP_I2C_SEL 44 ++#define CLK_TOP_PCIE_MBIST_250M_SEL 45 ++#define CLK_TOP_PEXTP_TL_SEL 46 ++#define CLK_TOP_PEXTP_TL_P1_SEL 47 ++#define CLK_TOP_USB_SYS_P1_SEL 48 ++#define CLK_TOP_USB_XHCI_P1_SEL 49 ++#define CLK_TOP_AUD_SEL 50 ++#define CLK_TOP_A1SYS_SEL 51 ++#define CLK_TOP_AUD_L_SEL 52 ++#define CLK_TOP_A_TUNER_SEL 53 ++#define CLK_TOP_USB_PHY_SEL 54 ++#define CLK_TOP_SGM_0_SEL 55 ++#define CLK_TOP_SGM_SBUS_0_SEL 56 ++#define CLK_TOP_SGM_1_SEL 57 ++#define CLK_TOP_SGM_SBUS_1_SEL 58 ++#define CLK_TOP_SYSAXI_SEL 59 ++#define CLK_TOP_SYSAPB_SEL 60 ++#define CLK_TOP_ETH_REFCK_50M_SEL 61 ++#define CLK_TOP_ETH_SYS_200M_SEL 62 ++#define CLK_TOP_ETH_SYS_SEL 63 ++#define CLK_TOP_ETH_XGMII_SEL 64 ++#define CLK_TOP_DRAMC_SEL 65 ++#define CLK_TOP_DRAMC_MD32_SEL 66 ++#define CLK_TOP_INFRA_F26M_SEL 67 ++#define CLK_TOP_PEXTP_P0_SEL 68 ++#define CLK_TOP_PEXTP_P1_SEL 69 ++#define CLK_TOP_DA_XTP_GLB_P0_SEL 70 ++#define CLK_TOP_DA_XTP_GLB_P1_SEL 71 ++#define CLK_TOP_CKM_SEL 72 ++#define CLK_TOP_DA_CKM_XTAL_SEL 73 ++#define CLK_TOP_PEXTP_SEL 74 ++#define CLK_TOP_ETH_MII_SEL 75 ++#define CLK_TOP_EMMC_200M_SEL 76 ++#define CLK_TOP_AUD_I2S_M 77 ++#define CLK_TOP_NR_CLK 78 ++ ++/* APMIXEDSYS */ ++ ++#define CLK_APMIXED_MPLL 0 ++#define CLK_APMIXED_APLL2 1 ++#define CLK_APMIXED_NET1PLL 2 ++#define CLK_APMIXED_NET2PLL 3 ++#define CLK_APMIXED_WEDMCUPLL 4 ++#define CLK_APMIXED_SGMPLL 5 ++#define CLK_APMIXED_ARM_LL 6 ++#define CLK_APMIXED_MSDCPLL 7 ++#define CLK_APMIXED_NR_CLK 8 ++ ++/* MCUSYS */ ++ ++#define CLK_MCU_BUS_DIV_SEL 0 ++#define CLK_MCU_NR_CLK 1 ++ ++/* SGMIISYS_0 */ ++ ++#define CLK_SGM0_TX_EN 0 ++#define CLK_SGM0_RX_EN 1 ++#define CLK_SGMII0_NR_CLK 2 ++ ++/* SGMIISYS_1 */ ++ ++#define CLK_SGM1_TX_EN 0 ++#define CLK_SGM1_RX_EN 1 ++#define CLK_SGMII1_NR_CLK 2 ++ ++/* ETHDMA */ ++ ++#define CLK_ETHDMA_FE_EN 0 ++#define CLK_ETHDMA_GP2_EN 1 ++#define CLK_ETHDMA_GP1_EN 2 ++#define CLK_ETHDMA_GP3_EN 3 ++#define CLK_ETHDMA_NR_CLK 4 ++ ++#endif /* _DT_BINDINGS_CLK_MT7987_H */ ++ +--- /dev/null ++++ b/include/dt-bindings/reset/mediatek,mt7987-resets.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ ++ ++#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT7987 ++#define _DT_BINDINGS_RESET_CONTROLLER_MT7987 ++ ++/* INFRA resets */ ++#define MT7987_INFRA_RST0_PEXTP_MAC_SWRST 0 ++#define MT7987_INFRA_RST1_THERM_CTRL_SWRST 1 ++ ++#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT7987 */ diff --git a/lede/target/linux/mediatek/patches-6.12/750-net-ethernet-mtk_eth_soc-add-mt7987-support.patch b/lede/target/linux/mediatek/patches-6.12/750-net-ethernet-mtk_eth_soc-add-mt7987-support.patch index 238e7a76bd..dcd815cec3 100644 --- a/lede/target/linux/mediatek/patches-6.12/750-net-ethernet-mtk_eth_soc-add-mt7987-support.patch +++ b/lede/target/linux/mediatek/patches-6.12/750-net-ethernet-mtk_eth_soc-add-mt7987-support.patch @@ -144,14 +144,14 @@ Signed-off-by: Bo-Cun Chen + .has_accounting = true, + .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, + .tx = { -+ DESC_SIZE(struct mtk_tx_dma_v2), ++ .desc_size = sizeof(struct mtk_tx_dma_v2), + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + .dma_size = MTK_DMA_SIZE(2K), + .fq_dma_size = MTK_DMA_SIZE(4K), + }, + .rx = { -+ DESC_SIZE(struct mtk_rx_dma_v2), ++ .desc_size = sizeof(struct mtk_rx_dma_v2), + .irq_done_mask = MTK_RX_DONE_INT_V2, + .dma_l4_valid = RX_DMA_L4_VALID_V2, + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, diff --git a/lede/target/linux/mediatek/patches-6.12/821-add-pwm-feature-for-mt7987.patch b/lede/target/linux/mediatek/patches-6.12/821-add-pwm-feature-for-mt7987.patch new file mode 100644 index 0000000000..5b8fe7efcf --- /dev/null +++ b/lede/target/linux/mediatek/patches-6.12/821-add-pwm-feature-for-mt7987.patch @@ -0,0 +1,44 @@ +From 7f4532a2bffdb0aebcabc2a672c4b97670e002a5 Mon Sep 17 00:00:00 2001 +From: Sam Shih +Date: Mon, 3 Mar 2025 14:33:33 +0800 +Subject: [PATCH] add pwm reg-v3 support for mt7987 + +--- + drivers/pwm/pwm-mediatek.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/pwm/pwm-mediatek.c ++++ b/drivers/pwm/pwm-mediatek.c +@@ -64,6 +64,10 @@ static const unsigned int mtk_pwm_reg_of + 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, 0x0240 + }; + ++static const unsigned int mtk_pwm_reg_offset_v3[] = { ++ 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x600, 0x700, 0x0800 ++}; ++ + static inline struct pwm_mediatek_chip * + to_pwm_mediatek_chip(struct pwm_chip *chip) + { +@@ -350,6 +354,13 @@ static const struct pwm_mediatek_of_data + .reg_offset = mtk_pwm_reg_offset_v1, + }; + ++static const struct pwm_mediatek_of_data mt7987_pwm_data = { ++ .num_pwms = 3, ++ .pwm45_fixup = false, ++ .has_ck_26m_sel = false, ++ .reg_offset = mtk_pwm_reg_offset_v3, ++}; ++ + static const struct pwm_mediatek_of_data mt7988_pwm_data = { + .num_pwms = 8, + .pwm45_fixup = false, +@@ -387,6 +398,7 @@ static const struct of_device_id pwm_med + { .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data }, + { .compatible = "mediatek,mt7981-pwm", .data = &mt7981_pwm_data }, + { .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data }, ++ { .compatible = "mediatek,mt7987-pwm", .data = &mt7987_pwm_data }, + { .compatible = "mediatek,mt7988-pwm", .data = &mt7988_pwm_data }, + { .compatible = "mediatek,mt8183-pwm", .data = &mt8183_pwm_data }, + { .compatible = "mediatek,mt8365-pwm", .data = &mt8365_pwm_data }, diff --git a/mieru/pkg/protocol/session.go b/mieru/pkg/protocol/session.go index 4fc17fbeac..686086ecf6 100644 --- a/mieru/pkg/protocol/session.go +++ b/mieru/pkg/protocol/session.go @@ -59,9 +59,9 @@ const ( // Maximum number of early retransmission attempt. earlyRetransmissionLimit = 1 // Send timeout back off multiplier. - txTimeoutBackOff = 1.25 + txTimeoutBackOff = 1.5 // Maximum back off multiplier. - maxBackOffMultiplier = 20.0 + maxBackOffDuration = 10 * time.Second ) type sessionState byte @@ -690,7 +690,6 @@ func (s *Session) runOutputOncePacket() { // To avoid deadlock, session can't be closed inside Ascend(). s.oLock.Lock() totalTransmissionCount := 0 - skipSendNewSegment := s.sendWindowSize() <= 0 s.sendBuf.Ascend(func(iter *segment) bool { bytesInFlight += int64(packetOverhead + len(iter.payload)) if iter.txCount >= txCountLimit { @@ -712,7 +711,7 @@ func (s *Session) runOutputOncePacket() { iter.ackCount = 0 iter.txCount++ iter.txTime = time.Now() - iter.txTimeout = s.rttStat.RTO() * time.Duration(mathext.Min(math.Pow(txTimeoutBackOff, float64(iter.txCount)), maxBackOffMultiplier)) + iter.txTimeout = mathext.Min(s.rttStat.RTO()*time.Duration(math.Pow(txTimeoutBackOff, float64(iter.txCount))), maxBackOffDuration) if isDataAckProtocol(iter.metadata.Protocol()) { das, _ := toDataAckStruct(iter.metadata) das.unAckSeq = s.nextRecv @@ -743,7 +742,7 @@ func (s *Session) runOutputOncePacket() { } // Send new segments in sendQueue. - skipSendNewSegment = skipSendNewSegment || totalTransmissionCount >= s.sendWindowSize() + skipSendNewSegment := s.sendWindowSize() <= 0 if s.sendQueue.Len() > 0 && !skipSendNewSegment { s.oLock.Lock() for { @@ -764,7 +763,7 @@ func (s *Session) runOutputOncePacket() { seg.txCount++ seg.txTime = time.Now() - seg.txTimeout = s.rttStat.RTO() * time.Duration(mathext.Min(math.Pow(txTimeoutBackOff, float64(seg.txCount)), maxBackOffMultiplier)) + seg.txTimeout = mathext.Min(s.rttStat.RTO()*time.Duration(math.Pow(txTimeoutBackOff, float64(seg.txCount))), maxBackOffDuration) if isDataAckProtocol(seg.metadata.Protocol()) { das, _ := toDataAckStruct(seg.metadata) das.unAckSeq = s.nextRecv @@ -1230,12 +1229,12 @@ func (s *Session) closeWithError(err error) error { return nil } -// sendWindowSize determines how many packets this session can send. +// sendWindowSize determines how many more packets this session can send. func (s *Session) sendWindowSize() int { - return mathext.Max(0, mathext.Min(int(s.cubicSendAlgorithm.CongestionWindowSize()), int(s.remoteWindowSize))) + return mathext.Max(0, mathext.Min(int(s.cubicSendAlgorithm.CongestionWindowSize())-s.sendBuf.Len(), int(s.remoteWindowSize))) } -// receiveWindowSize determines how many packets this session can receive. +// receiveWindowSize determines how many more packets this session can receive. func (s *Session) receiveWindowSize() int { var underlayWaitingPackets int if s.conn != nil { diff --git a/mieru/pkg/protocol/underlay_base.go b/mieru/pkg/protocol/underlay_base.go index 4d6a3d7a31..c2de26df70 100644 --- a/mieru/pkg/protocol/underlay_base.go +++ b/mieru/pkg/protocol/underlay_base.go @@ -37,7 +37,7 @@ const ( // Buffer received network packets before they are dropped by OS kernel. packetChanCapacityClient = 4 * 1024 - packetChanCapacityServer = 16 * 1024 + packetChanCapacityServer = 4 * 1024 ) // baseUnderlay contains a partial implementation of underlay. diff --git a/openwrt-packages/filebrowser/Makefile b/openwrt-packages/filebrowser/Makefile index 26df9d1c20..dfbe4194f9 100644 --- a/openwrt-packages/filebrowser/Makefile +++ b/openwrt-packages/filebrowser/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=filebrowser -PKG_VERSION:=2.46.1 +PKG_VERSION:=2.47.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/filebrowser/filebrowser/tar.gz/v${PKG_VERSION}? -PKG_HASH:=53e06f5501eaee32a89c6e1f7d211843c5cb37de042ac0fc45c25b5866f6b486 +PKG_HASH:=f90b2a9981545570006c0984aa39ee7178f4efd71d1ddf660c8661ea2f9bfbd6 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE diff --git a/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua b/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua index c9a72c2088..e876f4750b 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua @@ -301,7 +301,8 @@ function index_status() end function haproxy_status() - local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 + local e = {} + e["status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 http_write_json(e) end @@ -407,6 +408,11 @@ function add_node() local uuid = api.gen_short_uuid() uci:section(appname, "nodes", uuid) + local group = http.formvalue("group") + if group and group ~= "default" then + uci:set(appname, uuid, "group", group) + end + if redirect == "1" then api.uci_save(uci, appname) http.redirect(api.url("node_config", uuid)) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm index 8a6362d3fd..af65f8b72f 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm +++ b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm @@ -1,26 +1,30 @@ <% local api = require "luci.passwall.api" +local haproxy_enable = api.uci_get_type("@global_haproxy[0]", "balancing_enable", "0") local console_port = api.uci_get_type("@global_haproxy[0]", "console_port", "") -%>

diff --git a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm index e71efdbf19..73eebf4943 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm +++ b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm @@ -190,7 +190,7 @@ local api = require "luci.passwall.api"
- + -
- -
+
+
@@ -228,6 +227,18 @@ local api = require "luci.passwall.api"
<% if api.is_js_luci() then -%> @@ -158,6 +183,12 @@ table td, .table .td { } } + function to_add_node() { + const dom = document.getElementsByClassName("cbi-tab")[0]; + const current_group = dom.getAttribute("group_name") + window.location.href='<%=api.url("add_node")%>?redirect=1&group=' + current_group; + } + function copy_node(cbi_id) { window.location.href = '<%=api.url("copy_node")%>' + "?section=" + cbi_id; } @@ -490,7 +521,7 @@ table td, .table .td { {{node-tr}}
- ?redirect=1'"> +
@@ -505,7 +536,7 @@ table td, .table .td { {{tcping}} {{url_test}} -
+
@@ -651,7 +682,7 @@ table td, .table .td { } tab_ul_li_html += - '
  • ' + + '
  • ' + '' + group_name + " | " + "" + group_nodes[group].length + '' + '
  • ' tab_content_html += diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rule_update.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rule_update.lua index 705b8fcd0e..286b8aa1a5 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rule_update.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rule_update.lua @@ -41,14 +41,6 @@ local geo2rule = uci:get(name, "@global_rules[0]", "geo2rule") or "0" local geoip_update_ok, geosite_update_ok = false, false asset_location = asset_location:match("/$") and asset_location or (asset_location .. "/") ---兼容旧版本geo下载方式的配置,择机删除。 -if geoip_url:match(".*/([^/]+)$") == "latest" then - geoip_url = "https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip.dat" -end -if geosite_url:match(".*/([^/]+)$") == "latest" then - geosite_url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" -end - if arg3 == "cron" then arg2 = nil end diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist index d0d15bf30e..a2d11acaee 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnlist @@ -9488,6 +9488,7 @@ acthd123.com actime.net actions-semi.com actionsky.com +activate.activation-v2.kaspersky.com activation-gp.com activation-v2.kaspersky.com activeclub.net @@ -27069,6 +27070,7 @@ cztrjs.com cztv.cc cztv.com cztv.tv +cztvcdn.com cztvcloud.com cztzkg.com czur.com @@ -52654,7 +52656,6 @@ imlianpu.com imliuyi.com imlizhi.com immeee.com -immersivetranslate.com immfast.com immi520.com immiexpo.com @@ -52834,7 +52835,6 @@ inferoey.com infertilitybridge.com infimotion.com infineon-autoeco.com -infineon.com infini-ai.com infinisign.com infinitescript.com @@ -60866,6 +60866,18 @@ ksmmed.com ksmobile.com ksmobile.net ksmq5a9kxzmr.com +ksn-cinfo.geoksn.kaspersky.com +ksn-crypto-wifiplus.geoksn.kaspersky.com +ksn-dc1-cert.geoksn.kaspersky.com +ksn-dc1-file.geoksn.kaspersky.com +ksn-dc1.geoksn.kaspersky.com +ksn-file.geoksn.kaspersky.com +ksn-info.geoksn.kaspersky.com +ksn-kas.geoksn.kaspersky.com +ksn-mdr.geoksn.kaspersky.com +ksn-tcert.geoksn.kaspersky.com +ksn-url.geoksn.kaspersky.com +ksn-verdict.geoksn.kaspersky.com ksndsa.com ksnows.com ksoapp.com @@ -73986,7 +73998,6 @@ oogsy.com oohdear.com ooiii.com oojsq.com -ooklaserver.net oolap.com oomake.com oonne.com @@ -80421,6 +80432,7 @@ refineidea.com refire.com refond.com reformdata.org +refresh-bkg.activation-v2.kaspersky.com reg007.com regal-marathon.com regal-raptor.com @@ -92788,7 +92800,6 @@ thzab.com thzu.cc ti-node.com ti-solar.com -ti.com ti0s.com tiamaes.com tian-gang.com @@ -114581,6 +114592,7 @@ zhuanhuamao.com zhuanhuanqi.com zhuanhuanqi.net zhuaniao.com +zhuaninc.com zhuankeapp.com zhuankebang.com zhuankezu.com diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute index 1cbb565120..92559e4244 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute @@ -224,8 +224,6 @@ 103.132.234.0/23 103.133.128.0/23 103.133.176.0/22 -103.134.136.0/22 -103.135.100.0/24 103.135.160.0/22 103.135.192.0/23 103.135.195.0/24 @@ -271,7 +269,6 @@ 103.150.212.0/24 103.150.24.0/23 103.151.148.0/23 -103.151.179.0/24 103.151.216.0/23 103.151.228.0/23 103.152.170.0/23 @@ -375,8 +372,7 @@ 103.202.96.0/20 103.203.140.0/22 103.203.216.0/22 -103.203.56.0/23 -103.203.59.0/24 +103.203.56.0/22 103.203.96.0/22 103.204.72.0/22 103.205.188.0/22 @@ -745,7 +741,7 @@ 103.72.113.0/24 103.72.120.0/22 103.72.172.0/24 -103.72.224.0/24 +103.72.224.0/21 103.73.116.0/22 103.73.136.0/21 103.73.144.0/22 @@ -780,6 +776,7 @@ 103.81.4.0/22 103.81.48.0/22 103.82.224.0/22 +103.82.52.0/22 103.83.120.0/22 103.83.44.0/22 103.83.64.0/22 @@ -1096,7 +1093,7 @@ 113.47.112.0/20 113.47.128.0/18 113.47.204.0/22 -113.47.220.0/22 +113.47.216.0/21 113.47.232.0/21 113.47.248.0/21 113.47.64.0/19 @@ -1128,7 +1125,6 @@ 114.112.104.0/22 114.112.136.0/21 114.112.144.0/21 -114.112.160.0/21 114.112.200.0/21 114.112.208.0/20 114.112.24.0/21 @@ -1163,7 +1159,6 @@ 114.135.0.0/16 114.138.0.0/15 114.141.128.0/18 -114.142.136.0/23 114.196.0.0/15 114.212.0.0/14 114.216.0.0/13 @@ -1256,9 +1251,9 @@ 116.16.0.0/12 116.162.0.0/16 116.163.0.0/18 +116.165.0.0/16 116.167.0.0/16 -116.168.0.0/15 -116.171.0.0/16 +116.168.0.0/14 116.172.128.0/17 116.172.64.0/18 116.174.0.0/15 @@ -1292,6 +1287,7 @@ 116.198.64.0/21 116.198.72.0/22 116.198.80.0/21 +116.198.96.0/19 116.199.0.0/17 116.2.0.0/15 116.204.0.0/17 @@ -1338,7 +1334,7 @@ 117.122.192.0/18 117.124.231.0/24 117.124.232.0/22 -117.124.237.0/24 +117.124.236.0/23 117.124.240.0/23 117.124.242.0/24 117.124.98.0/24 @@ -1425,22 +1421,7 @@ 118.145.96.0/20 118.178.0.0/16 118.180.0.0/14 -118.184.0.0/22 -118.184.105.0/24 -118.184.106.0/23 118.184.128.0/17 -118.184.30.0/24 -118.184.40.0/21 -118.184.48.0/22 -118.184.52.0/24 -118.184.64.0/24 -118.184.66.0/23 -118.184.76.0/22 -118.184.81.0/24 -118.184.82.0/23 -118.184.84.0/22 -118.184.92.0/22 -118.184.96.0/22 118.186.0.0/19 118.186.112.0/21 118.186.128.0/18 @@ -1480,14 +1461,6 @@ 118.192.68.0/23 118.192.70.0/24 118.192.96.0/19 -118.193.128.0/23 -118.193.144.0/24 -118.193.152.0/22 -118.193.160.0/23 -118.193.162.0/24 -118.193.164.0/22 -118.193.176.0/24 -118.193.188.0/22 118.193.96.0/19 118.194.128.0/21 118.194.164.0/22 @@ -1536,6 +1509,7 @@ 118.64.0.0/21 118.64.248.0/21 118.66.112.0/23 +118.66.184.0/24 118.66.224.0/20 118.72.0.0/13 118.80.0.0/15 @@ -1978,10 +1952,7 @@ 124.14.64.0/18 124.14.7.0/24 124.14.8.0/21 -124.151.0.0/17 -124.151.128.0/18 -124.151.193.0/24 -124.151.224.0/19 +124.151.0.0/16 124.152.0.0/16 124.16.0.0/15 124.160.0.0/13 @@ -2016,7 +1987,6 @@ 124.240.0.0/17 124.240.128.0/18 124.243.192.0/18 -124.248.0.0/22 124.248.64.0/18 124.250.0.0/15 124.254.0.0/18 @@ -2154,7 +2124,7 @@ 144.255.0.0/16 144.36.146.0/23 144.48.180.0/22 -144.48.184.0/24 +144.48.184.0/22 144.48.212.0/22 144.48.252.0/22 144.48.64.0/22 @@ -2210,9 +2180,6 @@ 154.208.144.0/20 154.208.160.0/21 154.208.172.0/23 -154.218.6.0/23 -154.223.168.0/24 -154.48.237.0/24 154.72.42.0/24 154.72.44.0/24 154.72.47.0/24 @@ -2225,11 +2192,8 @@ 156.107.170.0/24 156.107.179.0/24 156.107.181.0/24 -156.227.1.0/24 -156.227.24.0/22 156.230.11.0/24 156.231.163.0/24 -156.236.116.0/24 156.237.104.0/23 156.242.5.0/24 156.242.6.0/24 @@ -2288,6 +2252,7 @@ 163.179.0.0/16 163.204.0.0/16 163.223.178.0/23 +163.227.40.0/24 163.228.0.0/16 163.244.246.0/24 163.47.4.0/22 @@ -2485,7 +2450,6 @@ 193.119.4.0/24 193.119.6.0/24 193.119.8.0/24 -193.233.49.0/24 194.127.229.0/24 194.138.202.0/23 194.138.245.0/24 @@ -2691,7 +2655,6 @@ 203.156.192.0/18 203.160.104.0/22 203.160.109.0/24 -203.160.110.0/23 203.160.129.0/24 203.160.192.0/24 203.160.196.0/24 @@ -2707,7 +2670,7 @@ 203.166.188.0/23 203.166.191.0/24 203.168.0.0/22 -203.168.129.0/24 +203.168.128.0/23 203.168.16.0/23 203.168.18.0/24 203.168.5.0/24 @@ -3353,6 +3316,7 @@ 220.154.0.0/20 220.154.128.0/22 220.154.132.0/23 +220.154.134.0/24 220.154.140.0/24 220.154.144.0/24 220.154.16.0/22 @@ -3540,6 +3504,7 @@ 223.64.0.0/10 223.8.0.0/13 23.133.188.0/24 +23.140.100.0/24 23.161.8.0/24 23.236.111.0/24 27.0.128.0/24 @@ -3825,6 +3790,7 @@ 43.250.32.0/22 43.250.4.0/22 43.250.96.0/22 +43.251.100.0/22 43.251.244.0/22 43.251.36.0/22 43.251.4.0/22 @@ -3863,6 +3829,7 @@ 44.30.28.0/24 44.31.216.0/24 44.31.28.0/24 +44.31.42.0/24 44.31.81.0/24 44.31.96.0/24 44.32.143.0/24 @@ -3872,6 +3839,7 @@ 45.112.232.0/22 45.113.20.0/22 45.113.200.0/22 +45.113.206.0/24 45.113.24.0/22 45.113.40.0/22 45.114.189.0/24 @@ -3917,12 +3885,7 @@ 45.147.6.0/24 45.151.47.0/24 45.157.88.0/24 -45.192.172.0/24 -45.192.187.0/24 -45.192.189.0/24 -45.192.190.0/24 45.195.6.0/24 -45.197.131.0/24 45.202.209.0/24 45.202.210.0/23 45.202.212.0/24 diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 index 024c19a22d..9e90cfd799 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 @@ -89,13 +89,11 @@ 2400:9380:9201::/48 2400:9380:9202::/48 2400:9380:9220::/47 -2400:9380:9240::/47 +2400:9380:9240::/48 2400:9380:9250::/47 2400:9380:9260::/48 2400:9380:9271::/48 -2400:9380:9272::/48 2400:9380:9280::/47 -2400:9380:9282::/48 2400:9380:92b0::/45 2400:95e0::/48 2400:9600:8800::/48 @@ -412,14 +410,13 @@ 2406:840:9600::/43 2406:840:9620::/44 2406:840:9961::/48 -2406:840:9962::/47 +2406:840:9963::/48 2406:840:996c::/48 -2406:840:c200::/40 +2406:840:c400::/40 2406:840:e080::/44 2406:840:e0cf::/48 2406:840:e0e0::/46 2406:840:e0e4::/47 -2406:840:e0e8::/48 2406:840:e10f::/48 2406:840:e14f::/48 2406:840:e201::/48 @@ -429,7 +426,7 @@ 2406:840:e600::/46 2406:840:e604::/47 2406:840:e606::/48 -2406:840:e60d::/48 +2406:840:e60c::/47 2406:840:e620::/47 2406:840:e666::/47 2406:840:e770::/48 @@ -468,7 +465,6 @@ 2406:840:fdc0::/44 2406:840:fdd1::/48 2406:840:fe27::/48 -2406:840:fe60::/44 2406:840:fe90::/46 2406:840:fe94::/48 2406:840:fe96::/47 @@ -486,7 +482,6 @@ 2406:840:fecc::/47 2406:840:fecf::/48 2406:840:fed1::/48 -2406:840:fed6::/48 2406:840:fed8::/48 2406:840:fedb::/48 2406:840:fedc::/48 @@ -655,82 +650,66 @@ 2408:8378::/31 2408:837a::/32 2408:8406:100::/41 -2408:8406:1800::/42 +2408:8406:1800::/43 2408:8406:180::/42 -2408:8406:1840::/43 2408:8406:18c0::/42 2408:8406:1900::/41 2408:8406:1980::/42 -2408:8406:2400::/42 -2408:8406:2440::/43 +2408:8406:2400::/43 2408:8406:24c0::/42 2408:8406:2500::/41 2408:8406:2580::/42 -2408:8406:3000::/42 -2408:8406:3040::/43 +2408:8406:3000::/43 2408:8406:30c0::/42 2408:8406:3100::/41 2408:8406:3180::/42 -2408:8406:3c00::/42 -2408:8406:3c40::/43 +2408:8406:3c00::/43 2408:8406:3cc0::/42 2408:8406:3d00::/41 2408:8406:3d80::/42 -2408:8406:40::/43 -2408:8406:4800::/42 -2408:8406:4840::/43 +2408:8406:4800::/43 2408:8406:48c0::/42 2408:8406:4900::/41 2408:8406:4980::/42 -2408:8406:5400::/42 -2408:8406:5440::/43 +2408:8406:5400::/43 2408:8406:54c0::/42 2408:8406:5500::/41 2408:8406:5580::/42 -2408:8406:6000::/42 -2408:8406:6040::/43 +2408:8406:6000::/43 2408:8406:60c0::/42 2408:8406:6100::/41 2408:8406:6180::/42 -2408:8406:6c00::/42 -2408:8406:6c40::/43 +2408:8406:6c00::/43 2408:8406:6cc0::/42 2408:8406:6d00::/41 2408:8406:6d80::/42 -2408:8406:7800::/42 -2408:8406:7840::/43 +2408:8406:7800::/43 2408:8406:78c0::/42 2408:8406:7900::/41 2408:8406:7980::/42 -2408:8406:8400::/42 -2408:8406:8440::/43 +2408:8406:8400::/43 2408:8406:84c0::/42 2408:8406:8500::/41 2408:8406:8580::/42 -2408:8406:9000::/42 -2408:8406:9040::/43 +2408:8406:9000::/43 2408:8406:90c0::/42 2408:8406:9100::/41 2408:8406:9180::/42 -2408:8406:9c00::/42 -2408:8406:9c40::/43 +2408:8406:9c00::/43 2408:8406:9cc0::/42 2408:8406:9d00::/41 2408:8406:9d80::/42 -2408:8406::/42 -2408:8406:a800::/42 -2408:8406:a840::/43 +2408:8406::/43 +2408:8406:a800::/43 2408:8406:a8c0::/42 2408:8406:a900::/41 2408:8406:a980::/42 -2408:8406:b400::/42 -2408:8406:b440::/43 +2408:8406:b400::/43 2408:8406:b4c0::/42 2408:8406:b500::/41 2408:8406:b580::/42 -2408:8406:c00::/42 +2408:8406:c00::/43 2408:8406:c0::/42 -2408:8406:c40::/43 2408:8406:cc0::/42 2408:8406:d00::/41 2408:8406:d80::/42 @@ -1214,15 +1193,16 @@ 240e::/20 2602:2e0:ff::/48 2602:f7ee:ee::/48 +2602:f92a:1314::/48 2602:f92a:a471::/48 2602:f92a:a473::/48 2602:f92a:a478::/48 2602:f92a:dead::/48 2602:f92a:e100::/44 -2602:f93b:400::/38 2602:f9ba:10c::/48 2602:f9ba:a8::/48 2602:fab0:11::/48 +2602:fed2:7051::/48 2602:feda:1bf::/48 2602:feda:1d1::/48 2602:feda:1df::/48 @@ -1244,7 +1224,6 @@ 2620:57:4004::/48 2804:1e48:9001::/48 2804:1e48:9002::/48 -2a01:f100:100::/48 2a01:f100:1f8::/48 2a04:3e00:1002::/48 2a04:f580:8010::/47 @@ -1271,13 +1250,10 @@ 2a04:f580:9280::/48 2a04:f580:9290::/48 2a05:1087::/32 -2a05:dfc3:ff00::/40 -2a06:1180:1000::/48 2a06:1281:8000::/36 2a06:3603::/32 2a06:3604::/30 2a06:9f81:4600::/43 -2a06:9f81:4620::/44 2a06:9f81:4640::/43 2a06:a005:1c40::/44 2a06:a005:260::/43 @@ -1298,14 +1274,18 @@ 2a0a:2846::/48 2a0a:6040:ec00::/40 2a0a:6044:6600::/39 -2a0a:6044:7a00::/40 2a0b:2542::/48 2a0b:4b81:1001::/48 2a0b:4e07:b8::/47 +2a0c:9a40:84e0::/48 2a0c:9a40:8fc1::/48 2a0c:9a40:8fc2::/47 2a0c:9a40:8fc4::/48 2a0c:b641:571::/48 +2a0c:b641:722::/47 +2a0c:b641:725::/48 +2a0c:b641:726::/47 +2a0c:b641:728::/47 2a0e:97c0:5ef::/48 2a0e:97c0:83f::/48 2a0e:9b00::/29 @@ -1324,7 +1304,6 @@ 2a0e:aa07:e030::/48 2a0e:aa07:e035::/48 2a0e:aa07:e039::/48 -2a0e:aa07:e044::/48 2a0e:aa07:e0e0::/44 2a0e:aa07:e151::/48 2a0e:aa07:e155::/48 @@ -1333,14 +1312,15 @@ 2a0e:aa07:e162::/48 2a0e:aa07:e16a::/48 2a0e:aa07:e1a0::/44 -2a0e:aa07:e1e0::/44 +2a0e:aa07:e1e1::/48 +2a0e:aa07:e1e2::/48 +2a0e:aa07:e1e6::/48 2a0e:aa07:e200::/44 2a0e:aa07:e210::/48 2a0e:aa07:e21c::/47 2a0e:aa07:e220::/44 2a0e:aa07:f0d0::/46 2a0e:aa07:f0d4::/47 -2a0e:aa07:f0d8::/48 2a0e:aa07:f0de::/47 2a0e:b107:12b::/48 2a0e:b107:14a0::/44 @@ -1351,23 +1331,26 @@ 2a0e:b107:c10::/48 2a0e:b107:da0::/44 2a0e:b107:dce::/48 -2a0f:1cc5:f00::/47 -2a0f:1cc5:f02::/48 -2a0f:1cc5:f05::/48 -2a0f:5707:ac00::/47 +2a0f:1cc5:10::/48 +2a0f:1cc5:20::/44 +2a0f:1cc5:600::/48 +2a0f:1cc5:f00::/46 +2a0f:1cc6:b100::/48 +2a0f:1cc6:b102::/47 +2a0f:1cc6:b104::/48 +2a0f:5707:ac01::/48 +2a0f:6284:3000::/36 +2a0f:6284:300::/40 +2a0f:6284:400::/42 +2a0f:6284:440::/43 2a0f:6284:4b00::/40 +2a0f:6284:4c20::/44 2a0f:6284:4c30::/48 2a0f:6284:4c40::/43 2a0f:6284:4c60::/44 2a0f:6284:4c80::/43 2a0f:7803:e300::/40 -2a0f:7803:f5d0::/44 -2a0f:7803:f5e0::/43 -2a0f:7803:f680::/43 -2a0f:7803:f6a0::/44 -2a0f:7803:f7c0::/42 -2a0f:7803:f800::/43 -2a0f:7803:f840::/44 +2a0f:7803:f680::/44 2a0f:7803:fa21::/48 2a0f:7803:fa22::/47 2a0f:7803:fa24::/46 @@ -1381,13 +1364,12 @@ 2a0f:7d07::/32 2a0f:85c1:ba5::/48 2a0f:85c1:bfe::/48 -2a0f:85c1:ca0::/44 2a0f:85c1:ce1::/48 2a0f:85c1:cf1::/48 -2a0f:85c1:d90::/48 2a0f:9400:6110::/48 2a0f:9400:7700::/48 2a0f:ac00::/29 +2a0f:ea47:fc1d::/48 2a10:2f00:15a::/48 2a10:ccc0:d00::/46 2a10:ccc0:d0a::/47 @@ -1411,18 +1393,25 @@ 2a13:a5c7:23c0::/48 2a13:a5c7:2801::/48 2a13:a5c7:3108::/48 -2a13:a5c7:31a0::/43 +2a13:a5c7:31a0::/44 +2a13:a5c7:31b0::/46 +2a13:a5c7:31b4::/47 +2a13:a5c7:31b6::/48 +2a13:a5c7:31b8::/45 2a13:a5c7:3301::/48 2a13:a5c7:3304::/48 2a13:a5c7:3306::/47 2a13:aac4:f000::/44 2a14:4c41::/32 2a14:67c1:20::/44 -2a14:67c1:702::/47 +2a14:67c1:702::/48 2a14:67c1:704::/48 2a14:67c1:70::/48 2a14:67c1:73::/48 2a14:67c1:74::/48 +2a14:67c1:800::/48 +2a14:67c1:802::/47 +2a14:67c1:804::/46 2a14:67c1:a010::/44 2a14:67c1:a020::/48 2a14:67c1:a023::/48 @@ -1452,6 +1441,7 @@ 2a14:67c1:b4c0::/45 2a14:67c1:b4e0::/43 2a14:67c1:b500::/47 +2a14:67c1:b514::/48 2a14:67c1:b549::/48 2a14:67c1:b561::/48 2a14:67c1:b563::/48 @@ -1468,7 +1458,6 @@ 2a14:7580:750::/47 2a14:7580:9208::/48 2a14:7580:9220::/44 -2a14:7580:9400::/39 2a14:7580:d000::/37 2a14:7580:d800::/39 2a14:7580:da00::/40 @@ -1477,15 +1466,14 @@ 2a14:7580:fff4::/48 2a14:7580:fff7::/48 2a14:7580:fffa::/48 -2a14:7581:30b5::/48 +2a14:7581:30b6::/48 2a14:7581:3100::/40 2a14:7581:3401::/48 2a14:7581:b12::/47 2a14:7581:b14::/47 2a14:7581:b20::/46 -2a14:7581:b40::/48 -2a14:7581:b44::/48 -2a14:7581:b60::/48 +2a14:7581:b40::/45 +2a14:7581:b60::/44 2a14:7581:ba0::/48 2a14:7581:bbb::/48 2a14:7581:bcd::/48 @@ -1493,6 +1481,7 @@ 2a14:7581:ffb::/48 2a14:7583:f201::/48 2a14:7583:f203::/48 +2a14:7583:f204::/48 2a14:7583:f300::/46 2a14:7583:f304::/47 2a14:7583:f460::/44 @@ -1505,8 +1494,8 @@ 2a14:7583:f708::/47 2a14:7583:f70a::/48 2a14:7583:f743::/48 +2a14:7583:f744::/48 2a14:7583:f764::/48 -2a14:7584::/36 2a14:7c0:4a01::/48 2a14:7c0:5103::/48 2c0f:f7a8:8011::/48 diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist index 02e24eb42f..22ddc69f7f 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/rules/gfwlist @@ -1,6 +1,7 @@ 000webhost.com 030buy.com 0rz.tw +1-apple.com.tw 1000giri.net 10beasts.net 10conditionsoflove.com @@ -297,6 +298,7 @@ aofriend.com aojiao.org aomedia.org aomiwang.com +aoxvpn.com apartmentratings.com apartments.com apat1989.org @@ -514,6 +516,7 @@ bestvpnusa.com bet365.com betaclouds.net betfair.com +bettergpt.chat betterhash.net betternet.co bettervpn.com @@ -816,6 +819,7 @@ cams.com cams.org.sg canadameet.com canalporno.com +canva.com canyu.org caobian.info caochangqing.com @@ -854,6 +858,7 @@ cccat.cc cccat.co ccfd.org.tw cchere.com +cchostvps.xyz ccim.org cclife.ca cclife.org @@ -916,9 +921,11 @@ chanworld.org chaoex.com chaos.social character.ai +chat.com chat.lmsys.org chatgpt.com chatnook.com +chatpdf.com chaturbate.com checkgfw.com chengmingmag.com @@ -1236,6 +1243,7 @@ danke4china.net daodu14.jigsy.com daolan.net darktech.org +darmau.co darpa.mil darrenliuwei.com dashlane.com @@ -1247,6 +1255,7 @@ dawangidc.com daxa.cn daylife.com db.tt +dbgjd.com dcard.tw dcmilitary.com ddc.com.tw @@ -1271,9 +1280,7 @@ deezer.com definebabe.com deja.com delcamp.net -delicious.com demo.unlock-music.dev -democrats.org demosisto.hk deno.dev depositphotos.com @@ -1707,6 +1714,7 @@ fhreports.net fiddle.jshell.net figprayer.com fileflyer.com +files.oaiusercontent.com fileserve.com filesor.com fillthesquare.org @@ -1731,6 +1739,7 @@ flagsonline.it flecheinthepeche.fr fleshbot.com fleursdeslettres.com +flexclip.com flexpool.io flgjustice.org flickr.com @@ -1742,6 +1751,7 @@ flipkart.com flitto.com flnet.org flog.tw +flowgpt.com flowhongkong.net flypool.org flyvpn.com @@ -1755,6 +1765,7 @@ focusvpn.com fofg.org fooooo.com forbes.com +forefront.ai foreignaffairs.com foreignpolicy.com form.new @@ -1793,6 +1804,7 @@ freebrowser.org freechal.com freechina.net freechina.news +freechinaweibo.com freeddns.com freeddns.org freedomcollection.org @@ -1830,6 +1842,7 @@ freevpn.nl freewallpaper4.me freewebs.com freewechat.com +freeweibo.com freewww.info freexinwen.com freeyellow.com @@ -1949,6 +1962,7 @@ getfoxyproxy.org getgom.com geti2p.net getiton.com +getjetso.com getlantern.org getmalus.com getmdl.io @@ -2391,6 +2405,7 @@ hgseav.com hhdcb3office.org hhthesakyatrizin.org hi-on.org.tw +hicairo.com hiccears.com hidden-advent.org hide.me @@ -2580,6 +2595,7 @@ hwayue.org.tw hxwk.org hxwq.org hybrid-analysis.com +hyperbeam.com hyperrate.com hypothes.is i-cable.com @@ -2644,6 +2660,7 @@ imagefap.com imageflea.com imageglass.org images-gaytube.com +images.prismic.io imageshack.us imagevenue.com imagezilla.net @@ -2817,7 +2834,6 @@ jex.com jgoodies.com jiangweiping.com jiaoyou8.com -jichangtj.com jiehua.cz jieshibaobao.com jifangge.com @@ -3013,6 +3029,7 @@ lenwhite.com lesoir.be letou.com letscorp.net +lexica.art lflink.com lflinkup.com lflinkup.net @@ -3052,6 +3069,7 @@ linkedin.com linkideo.com linktr.ee linkuswell.com +linux.do linux.org.hk linuxtoy.org lionsroar.com @@ -3076,6 +3094,7 @@ livevideo.com livingstream.com lizhizhuangbi.com lkcn.net +lmarena.ai load.to lobsangwangyal.com localbitcoins.com @@ -3105,6 +3124,7 @@ lsmkorean.org lsmradio.com lsmwebcast.com lsxszzg.com +lt.sntp.uk ltn.com.tw luckydesigner.space luckymobile.ca @@ -3958,9 +3978,11 @@ post852.com postadult.com posts.careerengine.us potato.im +potatso.com potvpn.com pourquoi.tw power.com +powerapple.com powercx.com powerphoto.org ppy.sh @@ -4142,6 +4164,7 @@ relay.firefox.com releaseinternational.org religionnews.com renminbao.com +rentry.co renyurenquan.org resilio.com resistchina.org @@ -4478,6 +4501,7 @@ songjianjun.com sonidodelaesperanza.org sopcast.com sopcast.org +sora.com sorting-algorithms.com sos.org sosad.fun @@ -4744,11 +4768,13 @@ telegraph.co.uk telesco.pe tellapart.com tellme.pw +temu.com tenacy.com tenor.com tensorflow.org tenzinpalmo.com terabox.com +terobox.com tew.org textnow.com textnow.me @@ -5295,6 +5321,7 @@ vewas.net vft.com.tw viber.com vica.info +victimsofcommunism.org vid.me vidble.com video.aol.ca @@ -5501,6 +5528,7 @@ whatbrowser.org whats.new whatsapp.com whatsapp.net +whatsonweibo.com wheelockslatin.com whereiswerner.com wheretowatch.com diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/controller/passwall2.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/controller/passwall2.lua index 7ed0d914ce..991bc92bc4 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/controller/passwall2.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/controller/passwall2.lua @@ -85,6 +85,7 @@ function index() entry({"admin", "services", appname, "subscribe_del_all"}, call("subscribe_del_all")).leaf = true entry({"admin", "services", appname, "subscribe_manual"}, call("subscribe_manual")).leaf = true entry({"admin", "services", appname, "subscribe_manual_all"}, call("subscribe_manual_all")).leaf = true + entry({"admin", "services", appname, "flush_set"}, call("flush_set")).leaf = true --[[Components update]] entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true @@ -256,7 +257,8 @@ function index_status() end function haproxy_status() - local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 + local e = {} + e["status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 http_write_json(e) end @@ -335,6 +337,11 @@ function add_node() local uuid = api.gen_short_uuid() uci:section(appname, "nodes", uuid) + local group = http.formvalue("group") + if group then + uci:set(appname, uuid, "group", group) + end + if redirect == "1" then api.uci_save(uci, appname) http.redirect(api.url("node_config", uuid)) @@ -765,3 +772,17 @@ function subscribe_manual_all() luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start all manual >/dev/null 2>&1 &") http_write_json({ success = true, msg = "Subscribe triggered." }) end + +function flush_set() + local redirect = http.formvalue("redirect") or "0" + local reload = http.formvalue("reload") or "0" + if reload == "1" then + uci:set(appname, '@global[0]', "flush_set", "1") + api.uci_save(uci, appname, true, true) + else + api.sh_uci_set(appname, "@global[0]", "flush_set", "1", true) + end + if redirect == "1" then + http.redirect(api.url("log")) + end +end diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index d3e54bc82d..da3879f810 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -350,16 +350,14 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat o.default = "1" o.rmempty = false -if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then - o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSet"), translate("Try this feature if the rule modification does not take effect.")) -else - o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSet"), translate("Try this feature if the rule modification does not take effect.")) -end -o.inputstyle = "remove" -function o.write(e, e) - m:set("@global[0]", "flush_set", "1") - api.uci_save(m.uci, appname, true, true) - luci.http.redirect(api.url("log")) +local use_nft = m:get("@global_forwarding[0]", "use_nft") == "1" +local set_title = api.i18n.translate(use_nft and "Clear NFTSET" or "Clear IPSET") +o = s:taboption("DNS", DummyValue, "clear_ipset", set_title, translate("Try this feature if the rule modification does not take effect.")) +o.rawhtml = true +function o.cfgvalue(self, section) + return string.format( + [[]], + api.url("flush_set") .. "?redirect=1&reload=1", set_title) end o = s:taboption("DNS", DummyValue, "_xray_node", "") diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua index e89a67d8c5..cd7cc8118c 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua @@ -187,7 +187,7 @@ o.validate = function(self, value, section) end o.write = function(self, section, value) local old = m:get(section, self.option) or "" - if old:lower() ~= value:lower() then + if old ~= value then m.uci:foreach(appname, "nodes", function(e) if e["group"] and e["group"]:lower() == old:lower() then m.uci:set(appname, e[".name"], "group", value) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua index 214f824bfb..42742722f6 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua @@ -93,7 +93,7 @@ o.validate = function(self, value, section) end o.write = function(self, section, value) local old = m:get(section, self.option) or "" - if old:lower() ~= value:lower() then + if old ~= value then m.uci:foreach(appname, "nodes", function(e) if e["group"] and e["group"]:lower() == old:lower() then m.uci:set(appname, e[".name"], "group", value) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua index 020e741783..efcf87dd61 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua @@ -31,6 +31,13 @@ if api.is_finded("geoview") then .. "
  • " .. translate("Analyzes and preloads GeoIP/Geosite data to enhance the shunt performance of Sing-box/Xray.") .. "
  • " .. "
  • " .. translate("Note: Increases resource usage.") .. "
  • " .. "" + function o.write(self, section, value) + local old = m:get(section, self.option) or "0" + if old ~= value then + m:set(section, "flush_set", "1") + end + return Flag.write(self, section, value) + end end s:append(Template(appname .. "/rule/rule_version")) diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua index b021a1b4af..5900c246a3 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua @@ -10,6 +10,10 @@ if not arg[1] or not m:get(arg[1]) then luci.http.redirect(m.redirect) end +function m.on_before_save(self) + m:set("@global[0]", "flush_set", "1") +end + -- Add inline CSS to map description m.description = (m.description or "") .. [[ <% if api.is_js_luci() then -%> @@ -100,6 +125,21 @@ table td, .table .td { return false } +<%- else %> + <%- end %> @@ -490,7 +536,7 @@ table td, .table .td { {{tcping}} {{url_test}} -
    +
    @@ -636,7 +682,7 @@ table td, .table .td { } tab_ul_li_html += - '
  • ' + + '
  • ' + '' + group_name + " | " + "" + group_nodes[group].length + '' + '
  • ' tab_content_html += diff --git a/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po b/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po index c646232fa1..b0ebdaeb65 100644 --- a/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/openwrt-passwall2/luci-app-passwall2/po/zh-cn/passwall2.po @@ -178,11 +178,11 @@ msgstr "DNS 重定向" msgid "Force special DNS server to need proxy devices." msgstr "强制需要代理的设备使用专用 DNS 服务器。" -msgid "Clear IPSet" -msgstr "清空 IPSet" +msgid "Clear IPSET" +msgstr "清空 IPSET" -msgid "Clear NFTSet" -msgstr "清空 NFTSet" +msgid "Clear NFTSET" +msgstr "清空 NFTSET" msgid "Try this feature if the rule modification does not take effect." msgstr "如果修改规则后没有生效,请尝试此功能。" @@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'开头,余下部分是一个名 msgid "Annotation: Begining with #" msgstr "注释: 由 # 开头" +msgid "Invert match result." +msgstr "反选匹配结果。" + +msgid "Only support Sing-Box." +msgstr "只支持 Sing-Box。" + msgid "IP: such as '127.0.0.1'." msgstr "IP: 形如'127.0.0.1'。" diff --git a/openwrt-passwall2/luci-app-passwall2/po/zh-tw/passwall2.po b/openwrt-passwall2/luci-app-passwall2/po/zh-tw/passwall2.po index 50caac1db3..7553d50ccd 100644 --- a/openwrt-passwall2/luci-app-passwall2/po/zh-tw/passwall2.po +++ b/openwrt-passwall2/luci-app-passwall2/po/zh-tw/passwall2.po @@ -178,11 +178,11 @@ msgstr "DNS 重定向" msgid "Force special DNS server to need proxy devices." msgstr "强制需要代理的設備使用专用 DNS 服務器。" -msgid "Clear IPSet" -msgstr "清空 IPSet" +msgid "Clear IPSET" +msgstr "清空 IPSET" -msgid "Clear NFTSet" -msgstr "清空 NFTSet" +msgid "Clear NFTSET" +msgstr "清空 NFTSET" msgid "Try this feature if the rule modification does not take effect." msgstr "如果修改規則後没有生效,请尝試此功能。" @@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'開头,余下部分是一个名 msgid "Annotation: Begining with #" msgstr "注释: 由 # 開头" +msgid "Invert match result." +msgstr "反選匹配結果。" + +msgid "Only support Sing-Box." +msgstr "只支持 Sing-Box。" + msgid "IP: such as '127.0.0.1'." msgstr "IP: 形如'127.0.0.1'。" diff --git a/shadowsocks-rust/Cargo.lock b/shadowsocks-rust/Cargo.lock index 84e58933b9..7352302c81 100644 --- a/shadowsocks-rust/Cargo.lock +++ b/shadowsocks-rust/Cargo.lock @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "version_check", "zerocopy", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -136,22 +136,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -204,7 +204,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -243,7 +243,7 @@ version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "cexpr", "clang-sys", "itertools", @@ -252,7 +252,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -263,9 +263,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.4" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "bitvec" @@ -355,7 +355,7 @@ dependencies = [ "base64", "bitvec", "getrandom 0.2.16", - "getrandom 0.3.3", + "getrandom 0.3.4", "hex", "indexmap", "js-sys", @@ -379,7 +379,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -448,9 +448,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.41" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "jobserver", @@ -523,7 +523,7 @@ checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ "iana-time-zone", "num-traits", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -572,9 +572,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cmake" @@ -700,9 +700,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -753,7 +753,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -777,9 +777,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] @@ -801,7 +801,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", "unicode-xid", ] @@ -851,7 +851,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -871,7 +871,7 @@ checksum = "0b0713d5c1d52e774c5cd7bb8b043d7c0fc4f921abfb678556140bfbe6ab2364" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -937,14 +937,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] name = "env_filter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", "regex", @@ -976,7 +976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1027,9 +1027,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "flate2" @@ -1152,7 +1152,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -1205,21 +1205,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.7+wasi-0.2.4", + "wasip2", "wasm-bindgen", ] @@ -1525,9 +1525,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" dependencies = [ "base64", "bytes", @@ -1541,7 +1541,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.1", "system-configuration", "tokio", "tower-service", @@ -1575,9 +1575,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", @@ -1588,9 +1588,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -1601,11 +1601,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -1616,42 +1615,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -1682,9 +1677,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown", @@ -1696,7 +1691,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "inotify-sys", "libc", ] @@ -1748,9 +1743,9 @@ dependencies = [ [[package]] name = "iri-string" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" dependencies = [ "memchr", "serde", @@ -1758,9 +1753,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" @@ -1799,26 +1794,26 @@ dependencies = [ [[package]] name = "jiff" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" dependencies = [ "jiff-static", "log", "portable-atomic", "portable-atomic-util", - "serde", + "serde_core", ] [[package]] name = "jiff-static" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -1827,15 +1822,15 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.81" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", @@ -1891,7 +1886,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -1910,7 +1905,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "libc", ] @@ -1931,9 +1926,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.22" +version = "1.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" dependencies = [ "cc", "pkg-config", @@ -1948,9 +1943,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "lock_api" @@ -2091,14 +2086,14 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", "log", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "wasi", + "windows-sys 0.61.2", ] [[package]] @@ -2148,7 +2143,7 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "cfg-if", "cfg_aliases", "libc", @@ -2170,7 +2165,7 @@ version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "fsevent-sys", "inotify", "kqueue", @@ -2233,9 +2228,9 @@ dependencies = [ [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "opaque-debug" @@ -2245,11 +2240,11 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.73" +version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "cfg-if", "foreign-types", "libc", @@ -2266,7 +2261,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -2277,18 +2272,18 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-src" -version = "300.5.3+3.5.4" +version = "300.5.4+3.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6bad8cd0233b63971e232cc9c5e83039375b8586d2312f31fda85db8f888c2" +checksum = "a507b3792995dae9b0df8a1c1e3771e8418b7c2d9f0baeba32e6fe8b06c7cb72" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.109" +version = "0.9.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" dependencies = [ "cc", "libc", @@ -2359,7 +2354,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -2398,7 +2393,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -2428,7 +2423,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -2510,9 +2505,9 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ "zerovec", ] @@ -2560,14 +2555,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -2592,7 +2587,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.10", + "socket2 0.6.1", "thiserror 2.0.17", "tokio", "tracing", @@ -2606,7 +2601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ "bytes", - "getrandom 0.3.3", + "getrandom 0.3.4", "lru-slab", "rand", "ring", @@ -2629,16 +2624,16 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.1", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -2690,7 +2685,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] @@ -2699,7 +2694,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", ] [[package]] @@ -2727,9 +2722,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "722166aa0d7438abbaa4d5cc2c649dac844e8c56d82fb3d33e9c34b5cd268fc6" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -2738,9 +2733,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3160422bbd54dd5ecfdca71e5fd59b7b8fe2b1697ab2baf64f6d05dcc66d298" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" @@ -2900,18 +2895,18 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "rustls" -version = "0.23.32" +version = "0.23.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" dependencies = [ "log", "once_cell", @@ -2936,9 +2931,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" dependencies = [ "web-time", "zeroize", @@ -2946,9 +2941,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.7" +version = "0.103.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" dependencies = [ "ring", "rustls-pki-types", @@ -2999,7 +2994,7 @@ checksum = "22f968c5ea23d555e670b449c1c5e7b2fc399fdaec1d304a17cd48e288abc107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3021,7 +3016,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -3034,7 +3029,7 @@ version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "core-foundation 0.10.1", "core-foundation-sys", "libc", @@ -3114,7 +3109,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3273,6 +3268,7 @@ dependencies = [ "shadowsocks-service", "snmalloc-rs", "sysexits", + "syslog-tracing", "tcmalloc", "thiserror 2.0.17", "time", @@ -3510,9 +3506,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -3536,7 +3532,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3545,13 +3541,24 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf9154bb31a0b747e214520c60cb9a842df871bf6a5fea5be4352b59d6c432ab" +[[package]] +name = "syslog-tracing" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d349bc2df408b4bf656709a29643641cef7f1795d708f88b105c626a8f64f6e4" +dependencies = [ + "libc", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "system-configuration" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -3600,10 +3607,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3642,7 +3649,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3653,7 +3660,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3710,9 +3717,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -3758,7 +3765,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3800,9 +3807,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -3832,7 +3839,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "bytes", "futures-util", "http", @@ -3888,7 +3895,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3939,7 +3946,7 @@ checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -3992,9 +3999,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-segmentation" @@ -4069,7 +4076,7 @@ version = "1.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "js-sys", "serde", "wasm-bindgen", @@ -4118,15 +4125,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" -dependencies = [ - "wasip2", -] - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -4138,9 +4136,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.104" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", @@ -4149,25 +4147,11 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.106", - "wasm-bindgen-shared", -] - [[package]] name = "wasm-bindgen-futures" -version = "0.4.54" +version = "0.4.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" dependencies = [ "cfg-if", "js-sys", @@ -4178,9 +4162,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.104" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4188,31 +4172,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.104" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.106", - "wasm-bindgen-backend", + "syn 2.0.110", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.104" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.81" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -4274,7 +4258,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -4291,9 +4275,9 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] @@ -4304,7 +4288,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -4315,15 +4299,9 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.1" @@ -4332,22 +4310,13 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-registry" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" dependencies = [ - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] @@ -4356,7 +4325,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4365,27 +4334,18 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "193cae8e647981c35bc947fdd57ba7928b1fa0d4a79305f6dd2dc55221ac35ac" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.10.0", "widestring", "windows-sys 0.59.0", ] -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - [[package]] name = "windows-strings" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4430,7 +4390,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4470,7 +4430,7 @@ version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link 0.2.1", + "windows-link", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -4663,9 +4623,9 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "wyz" @@ -4684,11 +4644,10 @@ checksum = "2fb433233f2df9344722454bc7e96465c9d03bff9d77c248f9e7523fe79585b5" [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -4696,13 +4655,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", "synstructure", ] @@ -4723,7 +4682,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] @@ -4743,7 +4702,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", "synstructure", ] @@ -4755,9 +4714,9 @@ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", "yoke", @@ -4766,9 +4725,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -4777,13 +4736,13 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.110", ] [[package]] diff --git a/shadowsocks-rust/Cargo.toml b/shadowsocks-rust/Cargo.toml index 6afe7dde79..dbb276108e 100644 --- a/shadowsocks-rust/Cargo.toml +++ b/shadowsocks-rust/Cargo.toml @@ -249,6 +249,7 @@ windows-service = { version = "0.8", optional = true } [target.'cfg(unix)'.dependencies] xdg = "3.0" +syslog-tracing = "0.3" [target.'cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))'.dependencies] reqwest = { version = "0.12", features = [ diff --git a/shadowsocks-rust/README.md b/shadowsocks-rust/README.md index cac87356ef..f1af1e8667 100644 --- a/shadowsocks-rust/README.md +++ b/shadowsocks-rust/README.md @@ -913,6 +913,17 @@ Example configuration: // Optional. If set, keeps the last N log files "max_files": 5 } + }, + { + // Configure a syslog writer, only supported on *nix system + "syslog": { + // `level` and `format` can also be set here, if not set, it will use the default values + + // Optional. Set the "identity" when calling openlog(). Use current service name by default. + "identity": "identity_name", + // Optional. Set the "facility" when calling openlog(). 1 (user-level messages) by default. See RFC5424. + "facility": 1 + } } ] }, diff --git a/shadowsocks-rust/build/build-release b/shadowsocks-rust/build/build-release index f58037164e..d0ab1b5414 100755 --- a/shadowsocks-rust/build/build-release +++ b/shadowsocks-rust/build/build-release @@ -91,7 +91,7 @@ function build() { PKG_DIR="${CUR_DIR}/release" mkdir -p "${PKG_DIR}" - if [[ "$TARGET" == *"-linux-"* ]]; then + if [[ "$TARGET" == *"-linux-"* || "$TARGET" == *"-freebsd" || "$TARGET" == *"-netbsd" ]]; then PKG_NAME="shadowsocks-v${VERSION}.${TARGET}.tar.xz" PKG_PATH="${PKG_DIR}/${PKG_NAME}" diff --git a/shadowsocks-rust/src/config.rs b/shadowsocks-rust/src/config.rs index d8f89da711..dacfeb3dc2 100644 --- a/shadowsocks-rust/src/config.rs +++ b/shadowsocks-rust/src/config.rs @@ -198,6 +198,8 @@ pub struct LogFormatConfig { pub enum LogWriterConfig { Console(LogConsoleWriterConfig), File(LogFileWriterConfig), + #[cfg(unix)] + Syslog(LogSyslogWriterConfig), } /// Console appender configuration for logging @@ -269,6 +271,25 @@ impl From for tracing_appender::rolling::Rotation { } } +/// File appender configuration for logging +#[cfg(all(feature = "logging", unix))] +#[derive(Deserialize, Debug, Clone)] +pub struct LogSyslogWriterConfig { + /// Level override + #[serde(default)] + pub level: Option, + /// Format override + #[serde(default)] + pub format: LogFormatConfigOverride, + + /// syslog identity, process name by default + #[serde(default)] + pub identity: Option, + /// Facility, 1 (USER) by default + #[serde(default)] + pub facility: Option, +} + /// Runtime mode (Tokio) #[derive(Deserialize, Debug, Clone, Copy, Default, Eq, PartialEq)] #[serde(rename_all = "snake_case")] diff --git a/shadowsocks-rust/src/logging/tracing.rs b/shadowsocks-rust/src/logging/tracing.rs index 42a1482dbd..3fc194df90 100644 --- a/shadowsocks-rust/src/logging/tracing.rs +++ b/shadowsocks-rust/src/logging/tracing.rs @@ -1,18 +1,21 @@ //! Logging facilities with tracing -use std::io; -use std::io::IsTerminal; +use std::io::{self, IsTerminal}; -use time::UtcOffset; -use time::format_description::well_known::Rfc3339; +#[cfg(unix)] +use syslog_tracing::Syslog; +use time::{UtcOffset, format_description::well_known::Rfc3339}; use tracing::level_filters::LevelFilter; use tracing_appender::rolling::{InitError, RollingFileAppender}; -use tracing_subscriber::fmt::MakeWriter; -use tracing_subscriber::fmt::time::OffsetTime; -use tracing_subscriber::layer::SubscriberExt; -use tracing_subscriber::util::SubscriberInitExt; -use tracing_subscriber::{EnvFilter, Layer, Registry, fmt}; +use tracing_subscriber::{ + fmt::{MakeWriter, time::OffsetTime}, + layer::SubscriberExt, + util::SubscriberInitExt, + {EnvFilter, Layer, Registry, fmt}, +}; +#[cfg(unix)] +use crate::config::LogSyslogWriterConfig; use crate::config::{ LogConfig, LogConsoleWriterConfig, LogFileWriterConfig, LogFormatConfig, LogFormatConfigOverride, LogWriterConfig, }; @@ -38,6 +41,8 @@ impl MakeLayer for LogWriterConfig { match self { LogWriterConfig::Console(console_config) => console_config.make_layer(bin_name, global), LogWriterConfig::File(file_config) => file_config.make_layer(bin_name, global), + #[cfg(unix)] + LogWriterConfig::Syslog(syslog_config) => syslog_config.make_layer(bin_name, global), } } } @@ -63,6 +68,17 @@ impl MakeLayer for LogFileWriterConfig { } } +#[cfg(unix)] +impl MakeLayer for LogSyslogWriterConfig { + fn make_layer(&self, bin_name: &str, global: &LogConfig) -> BoxedLayer { + let level = self.level.unwrap_or(global.level); + let format = apply_override(&global.format, &self.format); + + let syslog_writer = make_syslog_writer(bin_name, self); + make_fmt_layer(bin_name, level, &format, false, syslog_writer) + } +} + /// Boilerplate for configuring a `fmt::Layer` with `level` and `format` for different writers. fn make_fmt_layer(bin_name: &str, level: u32, format: &LogFormatConfig, ansi: bool, writer: W) -> BoxedLayer where @@ -162,3 +178,44 @@ fn apply_override(global: &LogFormatConfig, override_config: &LogFormatConfigOve without_time: override_config.without_time.unwrap_or(global.without_time), } } + +#[cfg(unix)] +fn make_syslog_writer(bin_name: &str, config: &LogSyslogWriterConfig) -> Syslog { + use std::ffi::CString; + + use syslog_tracing::{Facility, Options}; + + let identity = config.identity.as_deref().unwrap_or(bin_name); + let facility = match config.facility { + None => Facility::default(), + Some(f) => match f { + 1 => Facility::User, + 2 => Facility::Mail, + 3 => Facility::Daemon, + 4 => Facility::Auth, + 6 => Facility::Lpr, + 7 => Facility::News, + 8 => Facility::Uucp, + 9 => Facility::Cron, + 10 => Facility::AuthPriv, + 16 => Facility::Local0, + 17 => Facility::Local1, + 18 => Facility::Local2, + 19 => Facility::Local3, + 20 => Facility::Local4, + 21 => Facility::Local5, + 22 => Facility::Local6, + 23 => Facility::Local7, + _ => panic!("unsupported syslog facility: {}", f), + }, + }; + let options = Options::default(); + let identity = CString::new(identity).expect("syslog identity contains null-byte ('\\0')"); + + let syslogger = match Syslog::new(identity, options, facility) { + Some(l) => l, + None => panic!("syslog is already initialized"), + }; + + syslogger +} diff --git a/small/gn/Makefile b/small/gn/Makefile index d908747c00..54d4b12fd7 100644 --- a/small/gn/Makefile +++ b/small/gn/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://gn.googlesource.com/gn.git -PKG_SOURCE_DATE:=2025-11-09 -PKG_SOURCE_VERSION:=e7f3202128bdb2429872fdb138626a010b2bff7f -PKG_MIRROR_HASH:=841a6ec3b1a5a500319914e1a1e05f2163a4efcbe4a7f281e778a51918bf52b4 +PKG_SOURCE_DATE:=2025-11-16 +PKG_SOURCE_VERSION:=748c9571f3d18820a7989a880d5ddf220e54af1b +PKG_MIRROR_HASH:=46b5fd492c3209018f8cc769135b6eb7c1654e5ff8fb2b74b8295d29813623f5 PKG_LICENSE:=BSD 3-Clause PKG_LICENSE_FILES:=LICENSE diff --git a/small/gn/src/out/last_commit_position.h b/small/gn/src/out/last_commit_position.h index 92713e0f05..47f61f975b 100644 --- a/small/gn/src/out/last_commit_position.h +++ b/small/gn/src/out/last_commit_position.h @@ -3,7 +3,7 @@ #ifndef OUT_LAST_COMMIT_POSITION_H_ #define OUT_LAST_COMMIT_POSITION_H_ -#define LAST_COMMIT_POSITION_NUM 2292 -#define LAST_COMMIT_POSITION "2292 (e7f3202128bd)" +#define LAST_COMMIT_POSITION_NUM 2295 +#define LAST_COMMIT_POSITION "2295 (748c9571f3d1)" #endif // OUT_LAST_COMMIT_POSITION_H_ diff --git a/small/luci-app-passwall/luasrc/controller/passwall.lua b/small/luci-app-passwall/luasrc/controller/passwall.lua index 267f8be6db..e876f4750b 100644 --- a/small/luci-app-passwall/luasrc/controller/passwall.lua +++ b/small/luci-app-passwall/luasrc/controller/passwall.lua @@ -301,7 +301,8 @@ function index_status() end function haproxy_status() - local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 + local e = {} + e["status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 http_write_json(e) end @@ -407,6 +408,11 @@ function add_node() local uuid = api.gen_short_uuid() uci:section(appname, "nodes", uuid) + local group = http.formvalue("group") + if group and group ~= "default" then + uci:set(appname, uuid, "group", group) + end + if redirect == "1" then api.uci_save(uci, appname) http.redirect(api.url("node_config", uuid)) @@ -420,6 +426,20 @@ function set_node() local protocol = http.formvalue("protocol") local section = http.formvalue("section") uci:set(appname, "@global[0]", protocol .. "_node", section) + if protocol == "tcp" then + local node_protocol = uci:get(appname, section, "protocol") + if node_protocol == "_shunt" then + local type = uci:get(appname, section, "type") + local dns_shunt = uci:get(appname, "@global[0]", "dns_shunt") + local dns_key = (dns_shunt == "smartdns") and "smartdns_dns_mode" or "dns_mode" + local dns_mode = uci:get(appname, "@global[0]", dns_key) + local new_dns_mode = (type == "Xray") and "xray" or "sing-box" + if dns_mode ~= new_dns_mode then + uci:set(appname, "@global[0]", dns_key, new_dns_mode) + uci:set(appname, "@global[0]", "v2ray_dns_mode", "tcp") + end + end + end api.uci_save(uci, appname, true, true) http.redirect(api.url("log")) end diff --git a/small/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm b/small/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm index 8a6362d3fd..af65f8b72f 100644 --- a/small/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm +++ b/small/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm @@ -1,26 +1,30 @@ <% local api = require "luci.passwall.api" +local haproxy_enable = api.uci_get_type("@global_haproxy[0]", "balancing_enable", "0") local console_port = api.uci_get_type("@global_haproxy[0]", "console_port", "") -%>

    diff --git a/small/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm b/small/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm index e71efdbf19..73eebf4943 100644 --- a/small/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm +++ b/small/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm @@ -190,7 +190,7 @@ local api = require "luci.passwall.api"
    - + -
    - -
    +
    +
    @@ -228,6 +227,18 @@ local api = require "luci.passwall.api"
    +.td.cbi-section-actions { + text-align: right !important; +} + +.node-wrapper { + align-items: center; + display: inline-flex !important; + gap: 4px; +} + +.node-wrapper .cbi-input-checkbox { + flex-grow: 0 !important; + flex-basis: auto; +} + +.cbi-tabmenu > li { + margin-right: 2px !important; +} + +.cbi-tabmenu > li:last-child { + margin-right: 0 !important; +} + + + <% if api.is_js_luci() then -%> +<%- else %> + <%- end %> @@ -491,7 +536,7 @@ table td, .table .td { {{tcping}} {{url_test}} -
    +
    @@ -637,7 +682,7 @@ table td, .table .td { } tab_ul_li_html += - '
  • ' + + '
  • ' + '' + group_name + " | " + "" + group_nodes[group].length + '' + '
  • ' tab_content_html += diff --git a/small/luci-app-passwall/root/usr/share/passwall/rule_update.lua b/small/luci-app-passwall/root/usr/share/passwall/rule_update.lua index 705b8fcd0e..286b8aa1a5 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/rule_update.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/rule_update.lua @@ -41,14 +41,6 @@ local geo2rule = uci:get(name, "@global_rules[0]", "geo2rule") or "0" local geoip_update_ok, geosite_update_ok = false, false asset_location = asset_location:match("/$") and asset_location or (asset_location .. "/") ---兼容旧版本geo下载方式的配置,择机删除。 -if geoip_url:match(".*/([^/]+)$") == "latest" then - geoip_url = "https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip.dat" -end -if geosite_url:match(".*/([^/]+)$") == "latest" then - geosite_url = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" -end - if arg3 == "cron" then arg2 = nil end diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist b/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist index d0d15bf30e..a2d11acaee 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnlist @@ -9488,6 +9488,7 @@ acthd123.com actime.net actions-semi.com actionsky.com +activate.activation-v2.kaspersky.com activation-gp.com activation-v2.kaspersky.com activeclub.net @@ -27069,6 +27070,7 @@ cztrjs.com cztv.cc cztv.com cztv.tv +cztvcdn.com cztvcloud.com cztzkg.com czur.com @@ -52654,7 +52656,6 @@ imlianpu.com imliuyi.com imlizhi.com immeee.com -immersivetranslate.com immfast.com immi520.com immiexpo.com @@ -52834,7 +52835,6 @@ inferoey.com infertilitybridge.com infimotion.com infineon-autoeco.com -infineon.com infini-ai.com infinisign.com infinitescript.com @@ -60866,6 +60866,18 @@ ksmmed.com ksmobile.com ksmobile.net ksmq5a9kxzmr.com +ksn-cinfo.geoksn.kaspersky.com +ksn-crypto-wifiplus.geoksn.kaspersky.com +ksn-dc1-cert.geoksn.kaspersky.com +ksn-dc1-file.geoksn.kaspersky.com +ksn-dc1.geoksn.kaspersky.com +ksn-file.geoksn.kaspersky.com +ksn-info.geoksn.kaspersky.com +ksn-kas.geoksn.kaspersky.com +ksn-mdr.geoksn.kaspersky.com +ksn-tcert.geoksn.kaspersky.com +ksn-url.geoksn.kaspersky.com +ksn-verdict.geoksn.kaspersky.com ksndsa.com ksnows.com ksoapp.com @@ -73986,7 +73998,6 @@ oogsy.com oohdear.com ooiii.com oojsq.com -ooklaserver.net oolap.com oomake.com oonne.com @@ -80421,6 +80432,7 @@ refineidea.com refire.com refond.com reformdata.org +refresh-bkg.activation-v2.kaspersky.com reg007.com regal-marathon.com regal-raptor.com @@ -92788,7 +92800,6 @@ thzab.com thzu.cc ti-node.com ti-solar.com -ti.com ti0s.com tiamaes.com tian-gang.com @@ -114581,6 +114592,7 @@ zhuanhuamao.com zhuanhuanqi.com zhuanhuanqi.net zhuaniao.com +zhuaninc.com zhuankeapp.com zhuankebang.com zhuankezu.com diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute index 1cbb565120..92559e4244 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute @@ -224,8 +224,6 @@ 103.132.234.0/23 103.133.128.0/23 103.133.176.0/22 -103.134.136.0/22 -103.135.100.0/24 103.135.160.0/22 103.135.192.0/23 103.135.195.0/24 @@ -271,7 +269,6 @@ 103.150.212.0/24 103.150.24.0/23 103.151.148.0/23 -103.151.179.0/24 103.151.216.0/23 103.151.228.0/23 103.152.170.0/23 @@ -375,8 +372,7 @@ 103.202.96.0/20 103.203.140.0/22 103.203.216.0/22 -103.203.56.0/23 -103.203.59.0/24 +103.203.56.0/22 103.203.96.0/22 103.204.72.0/22 103.205.188.0/22 @@ -745,7 +741,7 @@ 103.72.113.0/24 103.72.120.0/22 103.72.172.0/24 -103.72.224.0/24 +103.72.224.0/21 103.73.116.0/22 103.73.136.0/21 103.73.144.0/22 @@ -780,6 +776,7 @@ 103.81.4.0/22 103.81.48.0/22 103.82.224.0/22 +103.82.52.0/22 103.83.120.0/22 103.83.44.0/22 103.83.64.0/22 @@ -1096,7 +1093,7 @@ 113.47.112.0/20 113.47.128.0/18 113.47.204.0/22 -113.47.220.0/22 +113.47.216.0/21 113.47.232.0/21 113.47.248.0/21 113.47.64.0/19 @@ -1128,7 +1125,6 @@ 114.112.104.0/22 114.112.136.0/21 114.112.144.0/21 -114.112.160.0/21 114.112.200.0/21 114.112.208.0/20 114.112.24.0/21 @@ -1163,7 +1159,6 @@ 114.135.0.0/16 114.138.0.0/15 114.141.128.0/18 -114.142.136.0/23 114.196.0.0/15 114.212.0.0/14 114.216.0.0/13 @@ -1256,9 +1251,9 @@ 116.16.0.0/12 116.162.0.0/16 116.163.0.0/18 +116.165.0.0/16 116.167.0.0/16 -116.168.0.0/15 -116.171.0.0/16 +116.168.0.0/14 116.172.128.0/17 116.172.64.0/18 116.174.0.0/15 @@ -1292,6 +1287,7 @@ 116.198.64.0/21 116.198.72.0/22 116.198.80.0/21 +116.198.96.0/19 116.199.0.0/17 116.2.0.0/15 116.204.0.0/17 @@ -1338,7 +1334,7 @@ 117.122.192.0/18 117.124.231.0/24 117.124.232.0/22 -117.124.237.0/24 +117.124.236.0/23 117.124.240.0/23 117.124.242.0/24 117.124.98.0/24 @@ -1425,22 +1421,7 @@ 118.145.96.0/20 118.178.0.0/16 118.180.0.0/14 -118.184.0.0/22 -118.184.105.0/24 -118.184.106.0/23 118.184.128.0/17 -118.184.30.0/24 -118.184.40.0/21 -118.184.48.0/22 -118.184.52.0/24 -118.184.64.0/24 -118.184.66.0/23 -118.184.76.0/22 -118.184.81.0/24 -118.184.82.0/23 -118.184.84.0/22 -118.184.92.0/22 -118.184.96.0/22 118.186.0.0/19 118.186.112.0/21 118.186.128.0/18 @@ -1480,14 +1461,6 @@ 118.192.68.0/23 118.192.70.0/24 118.192.96.0/19 -118.193.128.0/23 -118.193.144.0/24 -118.193.152.0/22 -118.193.160.0/23 -118.193.162.0/24 -118.193.164.0/22 -118.193.176.0/24 -118.193.188.0/22 118.193.96.0/19 118.194.128.0/21 118.194.164.0/22 @@ -1536,6 +1509,7 @@ 118.64.0.0/21 118.64.248.0/21 118.66.112.0/23 +118.66.184.0/24 118.66.224.0/20 118.72.0.0/13 118.80.0.0/15 @@ -1978,10 +1952,7 @@ 124.14.64.0/18 124.14.7.0/24 124.14.8.0/21 -124.151.0.0/17 -124.151.128.0/18 -124.151.193.0/24 -124.151.224.0/19 +124.151.0.0/16 124.152.0.0/16 124.16.0.0/15 124.160.0.0/13 @@ -2016,7 +1987,6 @@ 124.240.0.0/17 124.240.128.0/18 124.243.192.0/18 -124.248.0.0/22 124.248.64.0/18 124.250.0.0/15 124.254.0.0/18 @@ -2154,7 +2124,7 @@ 144.255.0.0/16 144.36.146.0/23 144.48.180.0/22 -144.48.184.0/24 +144.48.184.0/22 144.48.212.0/22 144.48.252.0/22 144.48.64.0/22 @@ -2210,9 +2180,6 @@ 154.208.144.0/20 154.208.160.0/21 154.208.172.0/23 -154.218.6.0/23 -154.223.168.0/24 -154.48.237.0/24 154.72.42.0/24 154.72.44.0/24 154.72.47.0/24 @@ -2225,11 +2192,8 @@ 156.107.170.0/24 156.107.179.0/24 156.107.181.0/24 -156.227.1.0/24 -156.227.24.0/22 156.230.11.0/24 156.231.163.0/24 -156.236.116.0/24 156.237.104.0/23 156.242.5.0/24 156.242.6.0/24 @@ -2288,6 +2252,7 @@ 163.179.0.0/16 163.204.0.0/16 163.223.178.0/23 +163.227.40.0/24 163.228.0.0/16 163.244.246.0/24 163.47.4.0/22 @@ -2485,7 +2450,6 @@ 193.119.4.0/24 193.119.6.0/24 193.119.8.0/24 -193.233.49.0/24 194.127.229.0/24 194.138.202.0/23 194.138.245.0/24 @@ -2691,7 +2655,6 @@ 203.156.192.0/18 203.160.104.0/22 203.160.109.0/24 -203.160.110.0/23 203.160.129.0/24 203.160.192.0/24 203.160.196.0/24 @@ -2707,7 +2670,7 @@ 203.166.188.0/23 203.166.191.0/24 203.168.0.0/22 -203.168.129.0/24 +203.168.128.0/23 203.168.16.0/23 203.168.18.0/24 203.168.5.0/24 @@ -3353,6 +3316,7 @@ 220.154.0.0/20 220.154.128.0/22 220.154.132.0/23 +220.154.134.0/24 220.154.140.0/24 220.154.144.0/24 220.154.16.0/22 @@ -3540,6 +3504,7 @@ 223.64.0.0/10 223.8.0.0/13 23.133.188.0/24 +23.140.100.0/24 23.161.8.0/24 23.236.111.0/24 27.0.128.0/24 @@ -3825,6 +3790,7 @@ 43.250.32.0/22 43.250.4.0/22 43.250.96.0/22 +43.251.100.0/22 43.251.244.0/22 43.251.36.0/22 43.251.4.0/22 @@ -3863,6 +3829,7 @@ 44.30.28.0/24 44.31.216.0/24 44.31.28.0/24 +44.31.42.0/24 44.31.81.0/24 44.31.96.0/24 44.32.143.0/24 @@ -3872,6 +3839,7 @@ 45.112.232.0/22 45.113.20.0/22 45.113.200.0/22 +45.113.206.0/24 45.113.24.0/22 45.113.40.0/22 45.114.189.0/24 @@ -3917,12 +3885,7 @@ 45.147.6.0/24 45.151.47.0/24 45.157.88.0/24 -45.192.172.0/24 -45.192.187.0/24 -45.192.189.0/24 -45.192.190.0/24 45.195.6.0/24 -45.197.131.0/24 45.202.209.0/24 45.202.210.0/23 45.202.212.0/24 diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 index 024c19a22d..9e90cfd799 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/chnroute6 @@ -89,13 +89,11 @@ 2400:9380:9201::/48 2400:9380:9202::/48 2400:9380:9220::/47 -2400:9380:9240::/47 +2400:9380:9240::/48 2400:9380:9250::/47 2400:9380:9260::/48 2400:9380:9271::/48 -2400:9380:9272::/48 2400:9380:9280::/47 -2400:9380:9282::/48 2400:9380:92b0::/45 2400:95e0::/48 2400:9600:8800::/48 @@ -412,14 +410,13 @@ 2406:840:9600::/43 2406:840:9620::/44 2406:840:9961::/48 -2406:840:9962::/47 +2406:840:9963::/48 2406:840:996c::/48 -2406:840:c200::/40 +2406:840:c400::/40 2406:840:e080::/44 2406:840:e0cf::/48 2406:840:e0e0::/46 2406:840:e0e4::/47 -2406:840:e0e8::/48 2406:840:e10f::/48 2406:840:e14f::/48 2406:840:e201::/48 @@ -429,7 +426,7 @@ 2406:840:e600::/46 2406:840:e604::/47 2406:840:e606::/48 -2406:840:e60d::/48 +2406:840:e60c::/47 2406:840:e620::/47 2406:840:e666::/47 2406:840:e770::/48 @@ -468,7 +465,6 @@ 2406:840:fdc0::/44 2406:840:fdd1::/48 2406:840:fe27::/48 -2406:840:fe60::/44 2406:840:fe90::/46 2406:840:fe94::/48 2406:840:fe96::/47 @@ -486,7 +482,6 @@ 2406:840:fecc::/47 2406:840:fecf::/48 2406:840:fed1::/48 -2406:840:fed6::/48 2406:840:fed8::/48 2406:840:fedb::/48 2406:840:fedc::/48 @@ -655,82 +650,66 @@ 2408:8378::/31 2408:837a::/32 2408:8406:100::/41 -2408:8406:1800::/42 +2408:8406:1800::/43 2408:8406:180::/42 -2408:8406:1840::/43 2408:8406:18c0::/42 2408:8406:1900::/41 2408:8406:1980::/42 -2408:8406:2400::/42 -2408:8406:2440::/43 +2408:8406:2400::/43 2408:8406:24c0::/42 2408:8406:2500::/41 2408:8406:2580::/42 -2408:8406:3000::/42 -2408:8406:3040::/43 +2408:8406:3000::/43 2408:8406:30c0::/42 2408:8406:3100::/41 2408:8406:3180::/42 -2408:8406:3c00::/42 -2408:8406:3c40::/43 +2408:8406:3c00::/43 2408:8406:3cc0::/42 2408:8406:3d00::/41 2408:8406:3d80::/42 -2408:8406:40::/43 -2408:8406:4800::/42 -2408:8406:4840::/43 +2408:8406:4800::/43 2408:8406:48c0::/42 2408:8406:4900::/41 2408:8406:4980::/42 -2408:8406:5400::/42 -2408:8406:5440::/43 +2408:8406:5400::/43 2408:8406:54c0::/42 2408:8406:5500::/41 2408:8406:5580::/42 -2408:8406:6000::/42 -2408:8406:6040::/43 +2408:8406:6000::/43 2408:8406:60c0::/42 2408:8406:6100::/41 2408:8406:6180::/42 -2408:8406:6c00::/42 -2408:8406:6c40::/43 +2408:8406:6c00::/43 2408:8406:6cc0::/42 2408:8406:6d00::/41 2408:8406:6d80::/42 -2408:8406:7800::/42 -2408:8406:7840::/43 +2408:8406:7800::/43 2408:8406:78c0::/42 2408:8406:7900::/41 2408:8406:7980::/42 -2408:8406:8400::/42 -2408:8406:8440::/43 +2408:8406:8400::/43 2408:8406:84c0::/42 2408:8406:8500::/41 2408:8406:8580::/42 -2408:8406:9000::/42 -2408:8406:9040::/43 +2408:8406:9000::/43 2408:8406:90c0::/42 2408:8406:9100::/41 2408:8406:9180::/42 -2408:8406:9c00::/42 -2408:8406:9c40::/43 +2408:8406:9c00::/43 2408:8406:9cc0::/42 2408:8406:9d00::/41 2408:8406:9d80::/42 -2408:8406::/42 -2408:8406:a800::/42 -2408:8406:a840::/43 +2408:8406::/43 +2408:8406:a800::/43 2408:8406:a8c0::/42 2408:8406:a900::/41 2408:8406:a980::/42 -2408:8406:b400::/42 -2408:8406:b440::/43 +2408:8406:b400::/43 2408:8406:b4c0::/42 2408:8406:b500::/41 2408:8406:b580::/42 -2408:8406:c00::/42 +2408:8406:c00::/43 2408:8406:c0::/42 -2408:8406:c40::/43 2408:8406:cc0::/42 2408:8406:d00::/41 2408:8406:d80::/42 @@ -1214,15 +1193,16 @@ 240e::/20 2602:2e0:ff::/48 2602:f7ee:ee::/48 +2602:f92a:1314::/48 2602:f92a:a471::/48 2602:f92a:a473::/48 2602:f92a:a478::/48 2602:f92a:dead::/48 2602:f92a:e100::/44 -2602:f93b:400::/38 2602:f9ba:10c::/48 2602:f9ba:a8::/48 2602:fab0:11::/48 +2602:fed2:7051::/48 2602:feda:1bf::/48 2602:feda:1d1::/48 2602:feda:1df::/48 @@ -1244,7 +1224,6 @@ 2620:57:4004::/48 2804:1e48:9001::/48 2804:1e48:9002::/48 -2a01:f100:100::/48 2a01:f100:1f8::/48 2a04:3e00:1002::/48 2a04:f580:8010::/47 @@ -1271,13 +1250,10 @@ 2a04:f580:9280::/48 2a04:f580:9290::/48 2a05:1087::/32 -2a05:dfc3:ff00::/40 -2a06:1180:1000::/48 2a06:1281:8000::/36 2a06:3603::/32 2a06:3604::/30 2a06:9f81:4600::/43 -2a06:9f81:4620::/44 2a06:9f81:4640::/43 2a06:a005:1c40::/44 2a06:a005:260::/43 @@ -1298,14 +1274,18 @@ 2a0a:2846::/48 2a0a:6040:ec00::/40 2a0a:6044:6600::/39 -2a0a:6044:7a00::/40 2a0b:2542::/48 2a0b:4b81:1001::/48 2a0b:4e07:b8::/47 +2a0c:9a40:84e0::/48 2a0c:9a40:8fc1::/48 2a0c:9a40:8fc2::/47 2a0c:9a40:8fc4::/48 2a0c:b641:571::/48 +2a0c:b641:722::/47 +2a0c:b641:725::/48 +2a0c:b641:726::/47 +2a0c:b641:728::/47 2a0e:97c0:5ef::/48 2a0e:97c0:83f::/48 2a0e:9b00::/29 @@ -1324,7 +1304,6 @@ 2a0e:aa07:e030::/48 2a0e:aa07:e035::/48 2a0e:aa07:e039::/48 -2a0e:aa07:e044::/48 2a0e:aa07:e0e0::/44 2a0e:aa07:e151::/48 2a0e:aa07:e155::/48 @@ -1333,14 +1312,15 @@ 2a0e:aa07:e162::/48 2a0e:aa07:e16a::/48 2a0e:aa07:e1a0::/44 -2a0e:aa07:e1e0::/44 +2a0e:aa07:e1e1::/48 +2a0e:aa07:e1e2::/48 +2a0e:aa07:e1e6::/48 2a0e:aa07:e200::/44 2a0e:aa07:e210::/48 2a0e:aa07:e21c::/47 2a0e:aa07:e220::/44 2a0e:aa07:f0d0::/46 2a0e:aa07:f0d4::/47 -2a0e:aa07:f0d8::/48 2a0e:aa07:f0de::/47 2a0e:b107:12b::/48 2a0e:b107:14a0::/44 @@ -1351,23 +1331,26 @@ 2a0e:b107:c10::/48 2a0e:b107:da0::/44 2a0e:b107:dce::/48 -2a0f:1cc5:f00::/47 -2a0f:1cc5:f02::/48 -2a0f:1cc5:f05::/48 -2a0f:5707:ac00::/47 +2a0f:1cc5:10::/48 +2a0f:1cc5:20::/44 +2a0f:1cc5:600::/48 +2a0f:1cc5:f00::/46 +2a0f:1cc6:b100::/48 +2a0f:1cc6:b102::/47 +2a0f:1cc6:b104::/48 +2a0f:5707:ac01::/48 +2a0f:6284:3000::/36 +2a0f:6284:300::/40 +2a0f:6284:400::/42 +2a0f:6284:440::/43 2a0f:6284:4b00::/40 +2a0f:6284:4c20::/44 2a0f:6284:4c30::/48 2a0f:6284:4c40::/43 2a0f:6284:4c60::/44 2a0f:6284:4c80::/43 2a0f:7803:e300::/40 -2a0f:7803:f5d0::/44 -2a0f:7803:f5e0::/43 -2a0f:7803:f680::/43 -2a0f:7803:f6a0::/44 -2a0f:7803:f7c0::/42 -2a0f:7803:f800::/43 -2a0f:7803:f840::/44 +2a0f:7803:f680::/44 2a0f:7803:fa21::/48 2a0f:7803:fa22::/47 2a0f:7803:fa24::/46 @@ -1381,13 +1364,12 @@ 2a0f:7d07::/32 2a0f:85c1:ba5::/48 2a0f:85c1:bfe::/48 -2a0f:85c1:ca0::/44 2a0f:85c1:ce1::/48 2a0f:85c1:cf1::/48 -2a0f:85c1:d90::/48 2a0f:9400:6110::/48 2a0f:9400:7700::/48 2a0f:ac00::/29 +2a0f:ea47:fc1d::/48 2a10:2f00:15a::/48 2a10:ccc0:d00::/46 2a10:ccc0:d0a::/47 @@ -1411,18 +1393,25 @@ 2a13:a5c7:23c0::/48 2a13:a5c7:2801::/48 2a13:a5c7:3108::/48 -2a13:a5c7:31a0::/43 +2a13:a5c7:31a0::/44 +2a13:a5c7:31b0::/46 +2a13:a5c7:31b4::/47 +2a13:a5c7:31b6::/48 +2a13:a5c7:31b8::/45 2a13:a5c7:3301::/48 2a13:a5c7:3304::/48 2a13:a5c7:3306::/47 2a13:aac4:f000::/44 2a14:4c41::/32 2a14:67c1:20::/44 -2a14:67c1:702::/47 +2a14:67c1:702::/48 2a14:67c1:704::/48 2a14:67c1:70::/48 2a14:67c1:73::/48 2a14:67c1:74::/48 +2a14:67c1:800::/48 +2a14:67c1:802::/47 +2a14:67c1:804::/46 2a14:67c1:a010::/44 2a14:67c1:a020::/48 2a14:67c1:a023::/48 @@ -1452,6 +1441,7 @@ 2a14:67c1:b4c0::/45 2a14:67c1:b4e0::/43 2a14:67c1:b500::/47 +2a14:67c1:b514::/48 2a14:67c1:b549::/48 2a14:67c1:b561::/48 2a14:67c1:b563::/48 @@ -1468,7 +1458,6 @@ 2a14:7580:750::/47 2a14:7580:9208::/48 2a14:7580:9220::/44 -2a14:7580:9400::/39 2a14:7580:d000::/37 2a14:7580:d800::/39 2a14:7580:da00::/40 @@ -1477,15 +1466,14 @@ 2a14:7580:fff4::/48 2a14:7580:fff7::/48 2a14:7580:fffa::/48 -2a14:7581:30b5::/48 +2a14:7581:30b6::/48 2a14:7581:3100::/40 2a14:7581:3401::/48 2a14:7581:b12::/47 2a14:7581:b14::/47 2a14:7581:b20::/46 -2a14:7581:b40::/48 -2a14:7581:b44::/48 -2a14:7581:b60::/48 +2a14:7581:b40::/45 +2a14:7581:b60::/44 2a14:7581:ba0::/48 2a14:7581:bbb::/48 2a14:7581:bcd::/48 @@ -1493,6 +1481,7 @@ 2a14:7581:ffb::/48 2a14:7583:f201::/48 2a14:7583:f203::/48 +2a14:7583:f204::/48 2a14:7583:f300::/46 2a14:7583:f304::/47 2a14:7583:f460::/44 @@ -1505,8 +1494,8 @@ 2a14:7583:f708::/47 2a14:7583:f70a::/48 2a14:7583:f743::/48 +2a14:7583:f744::/48 2a14:7583:f764::/48 -2a14:7584::/36 2a14:7c0:4a01::/48 2a14:7c0:5103::/48 2c0f:f7a8:8011::/48 diff --git a/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist b/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist index 02e24eb42f..22ddc69f7f 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist +++ b/small/luci-app-passwall/root/usr/share/passwall/rules/gfwlist @@ -1,6 +1,7 @@ 000webhost.com 030buy.com 0rz.tw +1-apple.com.tw 1000giri.net 10beasts.net 10conditionsoflove.com @@ -297,6 +298,7 @@ aofriend.com aojiao.org aomedia.org aomiwang.com +aoxvpn.com apartmentratings.com apartments.com apat1989.org @@ -514,6 +516,7 @@ bestvpnusa.com bet365.com betaclouds.net betfair.com +bettergpt.chat betterhash.net betternet.co bettervpn.com @@ -816,6 +819,7 @@ cams.com cams.org.sg canadameet.com canalporno.com +canva.com canyu.org caobian.info caochangqing.com @@ -854,6 +858,7 @@ cccat.cc cccat.co ccfd.org.tw cchere.com +cchostvps.xyz ccim.org cclife.ca cclife.org @@ -916,9 +921,11 @@ chanworld.org chaoex.com chaos.social character.ai +chat.com chat.lmsys.org chatgpt.com chatnook.com +chatpdf.com chaturbate.com checkgfw.com chengmingmag.com @@ -1236,6 +1243,7 @@ danke4china.net daodu14.jigsy.com daolan.net darktech.org +darmau.co darpa.mil darrenliuwei.com dashlane.com @@ -1247,6 +1255,7 @@ dawangidc.com daxa.cn daylife.com db.tt +dbgjd.com dcard.tw dcmilitary.com ddc.com.tw @@ -1271,9 +1280,7 @@ deezer.com definebabe.com deja.com delcamp.net -delicious.com demo.unlock-music.dev -democrats.org demosisto.hk deno.dev depositphotos.com @@ -1707,6 +1714,7 @@ fhreports.net fiddle.jshell.net figprayer.com fileflyer.com +files.oaiusercontent.com fileserve.com filesor.com fillthesquare.org @@ -1731,6 +1739,7 @@ flagsonline.it flecheinthepeche.fr fleshbot.com fleursdeslettres.com +flexclip.com flexpool.io flgjustice.org flickr.com @@ -1742,6 +1751,7 @@ flipkart.com flitto.com flnet.org flog.tw +flowgpt.com flowhongkong.net flypool.org flyvpn.com @@ -1755,6 +1765,7 @@ focusvpn.com fofg.org fooooo.com forbes.com +forefront.ai foreignaffairs.com foreignpolicy.com form.new @@ -1793,6 +1804,7 @@ freebrowser.org freechal.com freechina.net freechina.news +freechinaweibo.com freeddns.com freeddns.org freedomcollection.org @@ -1830,6 +1842,7 @@ freevpn.nl freewallpaper4.me freewebs.com freewechat.com +freeweibo.com freewww.info freexinwen.com freeyellow.com @@ -1949,6 +1962,7 @@ getfoxyproxy.org getgom.com geti2p.net getiton.com +getjetso.com getlantern.org getmalus.com getmdl.io @@ -2391,6 +2405,7 @@ hgseav.com hhdcb3office.org hhthesakyatrizin.org hi-on.org.tw +hicairo.com hiccears.com hidden-advent.org hide.me @@ -2580,6 +2595,7 @@ hwayue.org.tw hxwk.org hxwq.org hybrid-analysis.com +hyperbeam.com hyperrate.com hypothes.is i-cable.com @@ -2644,6 +2660,7 @@ imagefap.com imageflea.com imageglass.org images-gaytube.com +images.prismic.io imageshack.us imagevenue.com imagezilla.net @@ -2817,7 +2834,6 @@ jex.com jgoodies.com jiangweiping.com jiaoyou8.com -jichangtj.com jiehua.cz jieshibaobao.com jifangge.com @@ -3013,6 +3029,7 @@ lenwhite.com lesoir.be letou.com letscorp.net +lexica.art lflink.com lflinkup.com lflinkup.net @@ -3052,6 +3069,7 @@ linkedin.com linkideo.com linktr.ee linkuswell.com +linux.do linux.org.hk linuxtoy.org lionsroar.com @@ -3076,6 +3094,7 @@ livevideo.com livingstream.com lizhizhuangbi.com lkcn.net +lmarena.ai load.to lobsangwangyal.com localbitcoins.com @@ -3105,6 +3124,7 @@ lsmkorean.org lsmradio.com lsmwebcast.com lsxszzg.com +lt.sntp.uk ltn.com.tw luckydesigner.space luckymobile.ca @@ -3958,9 +3978,11 @@ post852.com postadult.com posts.careerengine.us potato.im +potatso.com potvpn.com pourquoi.tw power.com +powerapple.com powercx.com powerphoto.org ppy.sh @@ -4142,6 +4164,7 @@ relay.firefox.com releaseinternational.org religionnews.com renminbao.com +rentry.co renyurenquan.org resilio.com resistchina.org @@ -4478,6 +4501,7 @@ songjianjun.com sonidodelaesperanza.org sopcast.com sopcast.org +sora.com sorting-algorithms.com sos.org sosad.fun @@ -4744,11 +4768,13 @@ telegraph.co.uk telesco.pe tellapart.com tellme.pw +temu.com tenacy.com tenor.com tensorflow.org tenzinpalmo.com terabox.com +terobox.com tew.org textnow.com textnow.me @@ -5295,6 +5321,7 @@ vewas.net vft.com.tw viber.com vica.info +victimsofcommunism.org vid.me vidble.com video.aol.ca @@ -5501,6 +5528,7 @@ whatbrowser.org whats.new whatsapp.com whatsapp.net +whatsonweibo.com wheelockslatin.com whereiswerner.com wheretowatch.com diff --git a/small/luci-app-passwall2/luasrc/controller/passwall2.lua b/small/luci-app-passwall2/luasrc/controller/passwall2.lua index 7ed0d914ce..991bc92bc4 100644 --- a/small/luci-app-passwall2/luasrc/controller/passwall2.lua +++ b/small/luci-app-passwall2/luasrc/controller/passwall2.lua @@ -85,6 +85,7 @@ function index() entry({"admin", "services", appname, "subscribe_del_all"}, call("subscribe_del_all")).leaf = true entry({"admin", "services", appname, "subscribe_manual"}, call("subscribe_manual")).leaf = true entry({"admin", "services", appname, "subscribe_manual_all"}, call("subscribe_manual_all")).leaf = true + entry({"admin", "services", appname, "flush_set"}, call("flush_set")).leaf = true --[[Components update]] entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true @@ -256,7 +257,8 @@ function index_status() end function haproxy_status() - local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 + local e = {} + e["status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 http_write_json(e) end @@ -335,6 +337,11 @@ function add_node() local uuid = api.gen_short_uuid() uci:section(appname, "nodes", uuid) + local group = http.formvalue("group") + if group then + uci:set(appname, uuid, "group", group) + end + if redirect == "1" then api.uci_save(uci, appname) http.redirect(api.url("node_config", uuid)) @@ -765,3 +772,17 @@ function subscribe_manual_all() luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start all manual >/dev/null 2>&1 &") http_write_json({ success = true, msg = "Subscribe triggered." }) end + +function flush_set() + local redirect = http.formvalue("redirect") or "0" + local reload = http.formvalue("reload") or "0" + if reload == "1" then + uci:set(appname, '@global[0]', "flush_set", "1") + api.uci_save(uci, appname, true, true) + else + api.sh_uci_set(appname, "@global[0]", "flush_set", "1", true) + end + if redirect == "1" then + http.redirect(api.url("log")) + end +end diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index d3e54bc82d..da3879f810 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -350,16 +350,14 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat o.default = "1" o.rmempty = false -if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then - o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSet"), translate("Try this feature if the rule modification does not take effect.")) -else - o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSet"), translate("Try this feature if the rule modification does not take effect.")) -end -o.inputstyle = "remove" -function o.write(e, e) - m:set("@global[0]", "flush_set", "1") - api.uci_save(m.uci, appname, true, true) - luci.http.redirect(api.url("log")) +local use_nft = m:get("@global_forwarding[0]", "use_nft") == "1" +local set_title = api.i18n.translate(use_nft and "Clear NFTSET" or "Clear IPSET") +o = s:taboption("DNS", DummyValue, "clear_ipset", set_title, translate("Try this feature if the rule modification does not take effect.")) +o.rawhtml = true +function o.cfgvalue(self, section) + return string.format( + [[]], + api.url("flush_set") .. "?redirect=1&reload=1", set_title) end o = s:taboption("DNS", DummyValue, "_xray_node", "") diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua index e89a67d8c5..cd7cc8118c 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua @@ -187,7 +187,7 @@ o.validate = function(self, value, section) end o.write = function(self, section, value) local old = m:get(section, self.option) or "" - if old:lower() ~= value:lower() then + if old ~= value then m.uci:foreach(appname, "nodes", function(e) if e["group"] and e["group"]:lower() == old:lower() then m.uci:set(appname, e[".name"], "group", value) diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua index 214f824bfb..42742722f6 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua @@ -93,7 +93,7 @@ o.validate = function(self, value, section) end o.write = function(self, section, value) local old = m:get(section, self.option) or "" - if old:lower() ~= value:lower() then + if old ~= value then m.uci:foreach(appname, "nodes", function(e) if e["group"] and e["group"]:lower() == old:lower() then m.uci:set(appname, e[".name"], "group", value) diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua index 020e741783..efcf87dd61 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/rule.lua @@ -31,6 +31,13 @@ if api.is_finded("geoview") then .. "
  • " .. translate("Analyzes and preloads GeoIP/Geosite data to enhance the shunt performance of Sing-box/Xray.") .. "
  • " .. "
  • " .. translate("Note: Increases resource usage.") .. "
  • " .. "" + function o.write(self, section, value) + local old = m:get(section, self.option) or "0" + if old ~= value then + m:set(section, "flush_set", "1") + end + return Flag.write(self, section, value) + end end s:append(Template(appname .. "/rule/rule_version")) diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua index b021a1b4af..5900c246a3 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/shunt_rules.lua @@ -10,6 +10,10 @@ if not arg[1] or not m:get(arg[1]) then luci.http.redirect(m.redirect) end +function m.on_before_save(self) + m:set("@global[0]", "flush_set", "1") +end + -- Add inline CSS to map description m.description = (m.description or "") .. [[ <% if api.is_js_luci() then -%> @@ -100,6 +125,21 @@ table td, .table .td { return false } +<%- else %> + <%- end %> @@ -490,7 +536,7 @@ table td, .table .td { {{tcping}} {{url_test}} -
    +
    @@ -636,7 +682,7 @@ table td, .table .td { } tab_ul_li_html += - '
  • ' + + '
  • ' + '' + group_name + " | " + "" + group_nodes[group].length + '' + '
  • ' tab_content_html += diff --git a/small/luci-app-passwall2/po/zh-cn/passwall2.po b/small/luci-app-passwall2/po/zh-cn/passwall2.po index c646232fa1..b0ebdaeb65 100644 --- a/small/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/small/luci-app-passwall2/po/zh-cn/passwall2.po @@ -178,11 +178,11 @@ msgstr "DNS 重定向" msgid "Force special DNS server to need proxy devices." msgstr "强制需要代理的设备使用专用 DNS 服务器。" -msgid "Clear IPSet" -msgstr "清空 IPSet" +msgid "Clear IPSET" +msgstr "清空 IPSET" -msgid "Clear NFTSet" -msgstr "清空 NFTSet" +msgid "Clear NFTSET" +msgstr "清空 NFTSET" msgid "Try this feature if the rule modification does not take effect." msgstr "如果修改规则后没有生效,请尝试此功能。" @@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'开头,余下部分是一个名 msgid "Annotation: Begining with #" msgstr "注释: 由 # 开头" +msgid "Invert match result." +msgstr "反选匹配结果。" + +msgid "Only support Sing-Box." +msgstr "只支持 Sing-Box。" + msgid "IP: such as '127.0.0.1'." msgstr "IP: 形如'127.0.0.1'。" diff --git a/small/luci-app-passwall2/po/zh-tw/passwall2.po b/small/luci-app-passwall2/po/zh-tw/passwall2.po index 50caac1db3..7553d50ccd 100644 --- a/small/luci-app-passwall2/po/zh-tw/passwall2.po +++ b/small/luci-app-passwall2/po/zh-tw/passwall2.po @@ -178,11 +178,11 @@ msgstr "DNS 重定向" msgid "Force special DNS server to need proxy devices." msgstr "强制需要代理的設備使用专用 DNS 服務器。" -msgid "Clear IPSet" -msgstr "清空 IPSet" +msgid "Clear IPSET" +msgstr "清空 IPSET" -msgid "Clear NFTSet" -msgstr "清空 NFTSet" +msgid "Clear NFTSET" +msgstr "清空 NFTSET" msgid "Try this feature if the rule modification does not take effect." msgstr "如果修改規則後没有生效,请尝試此功能。" @@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'開头,余下部分是一个名 msgid "Annotation: Begining with #" msgstr "注释: 由 # 開头" +msgid "Invert match result." +msgstr "反選匹配結果。" + +msgid "Only support Sing-Box." +msgstr "只支持 Sing-Box。" + msgid "IP: such as '127.0.0.1'." msgstr "IP: 形如'127.0.0.1'。" diff --git a/small/luci-app-ssr-plus/root/usr/bin/ssr-rules b/small/luci-app-ssr-plus/root/usr/bin/ssr-rules index c580ea69c2..b3f9079acc 100755 --- a/small/luci-app-ssr-plus/root/usr/bin/ssr-rules +++ b/small/luci-app-ssr-plus/root/usr/bin/ssr-rules @@ -10,11 +10,12 @@ # Detect firewall version and set appropriate tools detect_firewall() { if command -v nft >/dev/null 2>&1 && \ - [ -n "$(uci get firewall.@defaults[0].syn_flood 2>/dev/null)" ] && \ + { [ -n "$(uci get firewall.@defaults[0].syn_flood 2>/dev/null)" ] || \ + [ -n "$(uci get firewall.@defaults[0].synflood_protect 2>/dev/null)" ]; } && \ ! grep -q "fw3" /etc/init.d/firewall 2>/dev/null; then USE_NFT=1 NFT="nft" - FWI=$(uci get firewall.shadowsocksr.path 2>/dev/null) # firewall include file + FWI=$(uci get firewall.shadowsocksr.path 2>/dev/null) # firewall include file else USE_NFT=0 IPT="iptables -t nat" # alias of iptables @@ -82,32 +83,59 @@ flush_r() { } flush_nftables() { - # Remove nftables rules and sets more carefully - $NFT delete table inet ss_spec 2>/dev/null - $NFT delete table ip ss_spec 2>/dev/null - $NFT delete table ip ss_spec_mangle 2>/dev/null - - # Clean up routing rules + # 删除 inet ss_spec 表 + if $NFT list table inet ss_spec >/dev/null 2>&1; then + # 删除所有链 + local CHAINS=$($NFT list table inet ss_spec | awk '/chain [a-zA-Z0-9_-]+/ {print $2}' | sort -u) + for chain in $CHAINS; do + $NFT flush chain inet ss_spec $chain 2>/dev/null + $NFT delete chain inet ss_spec $chain 2>/dev/null + done + + # 删除所有集合(set) + local SETS=$($NFT list table inet ss_spec | awk '/set [a-zA-Z0-9_-]+/ {print $2}' | sort -u) + for setname in $SETS; do + $NFT flush set inet ss_spec $setname 2>/dev/null + $NFT delete set inet ss_spec $setname 2>/dev/null + done + + # 删除整个表 + $NFT delete table inet ss_spec 2>/dev/null + fi + + # 删除 ip ss_spec_mangle 表(如果存在) + if $NFT list table ip ss_spec_mangle >/dev/null 2>&1; then + # 删除所有链 + local CHAINS=$($NFT list table ip ss_spec_mangle | awk '/chain [a-zA-Z0-9_-]+/ {print $2}' | sort -u) + for chain in $CHAINS; do + $NFT flush chain ip ss_spec_mangle $chain 2>/dev/null + $NFT delete chain ip ss_spec_mangle $chain 2>/dev/null + done + + # 删除所有集合(set) + local SETS=$($NFT list table ip ss_spec_mangle | awk '/set [a-zA-Z0-9_-]+/ {print $2}' | sort -u) + for setname in $SETS; do + $NFT flush set ip ss_spec_mangle $setname 2>/dev/null + $NFT delete set ip ss_spec_mangle $setname 2>/dev/null + done + + # 删除整个表 + $NFT delete table ip ss_spec_mangle 2>/dev/null + fi + + # 删除策略路由标记规则 ip rule del fwmark 0x01/0x01 table 100 2>/dev/null ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null - # 删除 nftables 集合 - $NFT delete set inet ss_spec ss_spec_lan_ac 2>/dev/null - $NFT delete set inet ss_spec ss_spec_wan_ac 2>/dev/null - $NFT delete set inet ss_spec ssr_gen_router 2>/dev/null - $NFT delete set inet ss_spec fplan 2>/dev/null - $NFT delete set inet ss_spec bplan 2>/dev/null - $NFT delete set inet ss_spec gmlan 2>/dev/null - $NFT delete set inet ss_spec oversea 2>/dev/null - $NFT delete set inet ss_spec whitelist 2>/dev/null - $NFT delete set inet ss_spec blacklist 2>/dev/null - $NFT delete set inet ss_spec netflix 2>/dev/null - $NFT delete set inet ss_spec gfwlist 2>/dev/null - $NFT delete set inet ss_spec china 2>/dev/null - $NFT delete set inet ss_spec music 2>/dev/null + # 可选:强制删除所有 ss_spec 相关的集合(即使表被误删) + for setname in ss_spec_lan_ac ss_spec_wan_ac ssr_gen_router fplan bplan gmlan oversea whitelist blacklist netflix gfwlist china music; do + $NFT delete set inet ss_spec $setname 2>/dev/null + $NFT delete set ip ss_spec_mangle $setname 2>/dev/null + done + # 重置防火墙 include 文件 [ -n "$FWI" ] && echo '#!/bin/sh' >"$FWI" - + return 0 } @@ -148,13 +176,13 @@ ipset_r() { } ipset_nft() { - [ -f "$IGNORE_LIST" ] && /usr/share/shadowsocksr/chinaipset.sh "$IGNORE_LIST" - # Create nftables table and sets - $NFT list table inet ss_spec >/dev/null 2>&1 || $NFT add table inet ss_spec + if ! $NFT list table inet ss_spec >/dev/null 2>&1; then + $NFT add table inet ss_spec 2>/dev/null + fi # Create necessary collections - for setname in ss_spec_wan_ac gmlan fplan bplan whitelist blacklist netflix; do + for setname in china gmlan fplan bplan whitelist blacklist netflix; do if ! $NFT list set inet ss_spec $setname >/dev/null 2>&1; then $NFT add set inet ss_spec $setname '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null else @@ -162,6 +190,11 @@ ipset_nft() { fi done + # 批量导入中国IP列表 + if [ -f "${china_ip:=/etc/ssrplus/china_ssr.txt}" ]; then + $NFT add element inet ss_spec china "{ $(tr '\n' ',' < "${china_ip}" | sed 's/,$//') }" 2>/dev/null + fi + # Add IP addresses to sets for ip in $LAN_GM_IP; do [ -n "$ip" ] && $NFT add element inet ss_spec gmlan "{ $ip }" 2>/dev/null @@ -181,7 +214,7 @@ ipset_nft() { # Create main chain for WAN access control if ! $NFT list chain inet ss_spec ss_spec_wan_ac >/dev/null 2>&1; then - $NFT add chain inet ss_spec ss_spec_wan_ac '{ type nat hook prerouting priority dstnat - 1; policy accept; }' 2>/dev/null + $NFT add chain inet ss_spec ss_spec_wan_ac 2>/dev/null fi $NFT flush chain inet ss_spec ss_spec_wan_ac 2>/dev/null @@ -197,18 +230,21 @@ ipset_nft() { # Add basic rules $NFT add rule inet ss_spec ss_spec_wan_ac tcp dport 53 ip daddr 127.0.0.0/8 return - $NFT add rule inet ss_spec ss_spec_wan_ac udp dport 53 ip daddr 127.0.0.0/8 return $NFT add rule inet ss_spec ss_spec_wan_ac tcp dport != 53 ip daddr "$server" return - $NFT add rule inet ss_spec ss_spec_wan_ac udp dport != 53 ip daddr "$server" return - - # Add special IP ranges to WAN AC set - for ip in $(gen_spec_iplist); do - [ -n "$ip" ] && $NFT add element inet ss_spec ss_spec_wan_ac "{ $ip }" 2>/dev/null - done # Set up mode-specific rules case "$RUNMODE" in router) + if ! $NFT list set inet ss_spec ss_spec_wan_ac >/dev/null 2>&1; then + $NFT add set inet ss_spec ss_spec_wan_ac '{ type ipv4_addr; flags interval; auto-merge; }' + else + $NFT flush set inet ss_spec ss_spec_wan_ac 2>/dev/null + fi + # Add special IP ranges to WAN AC set + for ip in $(gen_spec_iplist); do + [ -n "$ip" ] && $NFT add element inet ss_spec ss_spec_wan_ac "{ $ip }" 2>/dev/null + done + $NFT add rule inet ss_spec ss_spec_wan_ac ip daddr @ss_spec_wan_ac return $NFT add rule inet ss_spec ss_spec_wan_ac ip daddr @china return 2>/dev/null if $NFT list chain inet ss_spec ss_spec_wan_fw >/dev/null 2>&1; then @@ -217,7 +253,9 @@ ipset_nft() { fi ;; gfw) - $NFT add set inet ss_spec gfwlist '{ type ipv4_addr; flags interval; }' 2>/dev/null + if ! $NFT list set inet ss_spec gfwlist >/dev/null 2>&1; then + $NFT add set inet ss_spec gfwlist '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null + fi $NFT add rule inet ss_spec ss_spec_wan_ac ip daddr @china return 2>/dev/null $NFT add rule inet ss_spec ss_spec_wan_ac ip daddr @gfwlist jump ss_spec_wan_fw 2>/dev/null if $NFT list chain inet ss_spec ss_spec_wan_fw >/dev/null 2>&1; then @@ -225,9 +263,11 @@ ipset_nft() { fi ;; oversea) - $NFT add set inet ss_spec oversea '{ type ipv4_addr; flags interval; }' 2>/dev/null + if ! $NFT list set inet ss_spec oversea >/dev/null 2>&1; then + $NFT add set inet ss_spec oversea '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null + fi if $NFT list chain inet ss_spec ss_spec_wan_fw >/dev/null 2>&1; then - $NFT insert rule inet ss_spec ss_spec_wan_ac ip daddr @oversea jump SS_SPEC_WAN_FW 2>/dev/null + $NFT insert rule inet ss_spec ss_spec_wan_ac ip daddr @oversea jump ss_spec_wan_fw 2>/dev/null $NFT add rule inet ss_spec ss_spec_wan_ac ip saddr @gmlan jump ss_spec_wan_fw 2>/dev/null $NFT add rule inet ss_spec ss_spec_wan_ac ip daddr @china jump ss_spec_wan_fw 2>/dev/null fi @@ -255,21 +295,21 @@ ipset_nft() { for ip in $(cat "$SHUNT_LIST" 2>/dev/null); do [ -n "$ip" ] && $NFT add element inet ss_spec netflix "{ $ip }" 2>/dev/null done - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') case "$SHUNT_PORT" in 1) - $NFT insert rule inet ss_spec ss_spec_wan_ac tcp dport { $PORTS } ip daddr @netflix redirect to :"$local_port" + $NFT insert rule inet ss_spec ss_spec_wan_ac ip daddr @netflix meta l4proto tcp redirect to :"$local_port" ;; *) - $NFT insert rule inet ss_spec ss_spec_wan_ac tcp dport { $PORTS } ip daddr @netflix redirect to :"$SHUNT_PORT" + $NFT insert rule inet ss_spec ss_spec_wan_ac ip daddr @netflix meta l4proto tcp redirect to :"$SHUNT_PORT" if [ "$SHUNT_PROXY" = "1" ]; then - $NFT insert rule inet ss_spec ss_spec_wan_ac tcp dport { $PORTS } ip daddr "$SHUNT_IP" redirect to :"$local_port" + $NFT insert rule inet ss_spec ss_spec_wan_ac ip daddr "$SHUNT_IP" meta l4proto tcp redirect to :"$local_port" else [ -n "$SHUNT_IP" ] && $NFT add element inet ss_spec whitelist "{ $SHUNT_IP }" 2>/dev/null fi ;; esac fi + return $? } @@ -309,10 +349,10 @@ ipset_iptables() { esac ipset -N fplan hash:net 2>/dev/null for ip in $LAN_FP_IP; do ipset -! add fplan "$ip"; done - $IPT -I SS_SPEC_WAN_AC -m set --match-set fplan src -j SS_SPEC_WAN_FW + $IPT -I SS_SPEC_WAN_AC -m set --match-set fplan src -j SS_SPEC_WAN_FW ipset -N bplan hash:net 2>/dev/null for ip in $LAN_BP_IP; do ipset -! add bplan "$ip"; done - $IPT -I SS_SPEC_WAN_AC -m set --match-set bplan src -j RETURN + $IPT -I SS_SPEC_WAN_AC -m set --match-set bplan src -j RETURN ipset -N whitelist hash:net 2>/dev/null ipset -N blacklist hash:net 2>/dev/null $IPT -I SS_SPEC_WAN_AC -m set --match-set blacklist dst -j SS_SPEC_WAN_FW @@ -354,31 +394,24 @@ fw_rule() { fw_rule_nft() { # Exclude special local addresses - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 0.0.0.0/8 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 10.0.0.0/8 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 127.0.0.0/8 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 169.254.0.0/16 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 172.16.0.0/12 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 192.168.0.0/16 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 224.0.0.0/4 return - $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr 240.0.0.0/4 return + if $NFT list chain inet ss_spec ss_spec_wan_fw >/dev/null 2>&1; then + for net in 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4; do + $NFT add rule inet ss_spec ss_spec_wan_fw ip daddr $net return 2>/dev/null + done + fi # redirect/translation: when PROXY_PORTS present, redirect those tcp ports to local_port if [ -n "$PROXY_PORTS" ]; then PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - if ! $NFT list chain inet ss_spec ss_spec_wan_fw 2>/dev/null | grep -q "tcp dport { $PORTS } redirect to :$local_port"; then - if ! $NFT add rule inet ss_spec ss_spec_wan_fw tcp dport { $PORTS } redirect to :"$local_port" 2>/dev/null; then - loger 3 "Can't redirect, please check nftables." - return 1 - fi - fi + RULE="tcp dport { $PORTS } redirect to :"$local_port"" else # default: redirect everything except ssh(22) - if ! $NFT list chain inet ss_spec ss_spec_wan_fw 2>/dev/null | grep -q "tcp dport != 22 redirect to :$local_port"; then - if ! $NFT add rule inet ss_spec ss_spec_wan_fw tcp dport != 22 redirect to :$local_port 2>/dev/null; then - loger 3 "Can't redirect, please check nftables." - return 1 - fi + RULE="tcp dport != 22 redirect to :"$local_port"" + fi + if ! $NFT list chain inet ss_spec ss_spec_wan_fw 2>/dev/null | grep -q "$RULE"; then + if ! $NFT add rule inet ss_spec ss_spec_wan_fw $RULE 2>/dev/null; then + loger 3 "Can't redirect, please check nftables." + return 1 fi fi @@ -416,7 +449,12 @@ ac_rule_nft() { if [ -n "$LAN_AC_IP" ]; then # Create LAN access control set if needed - $NFT add set inet ss_spec ss_spec_lan_ac '{ type ipv4_addr; flags interval; }' 2>/dev/null + if ! $NFT list set inet ss_spec ss_spec_lan_ac >/dev/null 2>&1; then + $NFT add set inet ss_spec ss_spec_lan_ac '{ type ipv4_addr; flags interval; }' 2>/dev/null + else + $NFT flush set inet ss_spec ss_spec_lan_ac 2>/dev/null + fi + for ip in ${LAN_AC_IP#?}; do [ -n "$ip" ] && $NFT add element inet ss_spec ss_spec_lan_ac "{ $ip }" 2>/dev/null done @@ -436,25 +474,29 @@ ac_rule_nft() { fi # 创建ss_spec_prerouting链 - if ! $NFT list chain inet ss_spec_prerouting >/dev/null 2>&1; then - $NFT add chain inet ss_spec ss_spec_prerouting '{ type filter hook prerouting priority -1; policy accept; }' + if ! $NFT list chain inet ss_spec ss_spec_prerouting >/dev/null 2>&1; then + $NFT add chain inet ss_spec ss_spec_prerouting '{ type nat hook prerouting priority -150; policy accept; }' fi $NFT flush chain inet ss_spec ss_spec_prerouting 2>/dev/null # 创建ss_spec_output链 if ! $NFT list chain inet ss_spec ss_spec_output >/dev/null 2>&1; then - $NFT add chain inet ss_spec ss_spec_output '{ type nat hook output priority -1; policy accept; }' + $NFT add chain inet ss_spec ss_spec_output '{ type nat hook output priority -100; policy accept; }' fi $NFT flush chain inet ss_spec ss_spec_output 2>/dev/null # Build a rule in the prerouting hook chain that jumps to business chain with conditions + if [ -n "$PROXY_PORTS" ]; then + EXT_ARGS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') + fi + if [ -z "$Interface" ]; then # generic prerouting jump already exists (see ipset_nft), but if we have MATCH_SET_CONDITION we add a more specific rule if [ -n "$MATCH_SET" ]; then # add a more specific rule at the top of ss_spec_prerouting - $NFT insert rule inet ss_spec ss_spec_prerouting tcp dport $EXT_ARGS $MATCH_SET comment "\"$TAG\"" jump ss_spec_wan_ac 2>/dev/null + $NFT insert rule inet ss_spec ss_spec_prerouting meta l4proto tcp th dport { $EXT_ARGS } $MATCH_SET jump ss_spec_wan_ac comment "\"$TAG\"" 2>/dev/null else - $NFT insert rule inet ss_spec ss_spec_prerouting tcp dport $EXT_ARGS comment "\"$TAG\"" jump ss_spec_wan_ac + $NFT insert rule inet ss_spec ss_spec_prerouting meta l4proto tcp th dport { $EXT_ARGS } jump ss_spec_wan_ac comment "\"$TAG\"" 2>/dev/null fi else # For each Interface, find its actual ifname and add an iifname-limited prerouting rule @@ -463,9 +505,9 @@ ac_rule_nft() { [ -z "$IFNAME" ] && IFNAME=$(uci -P /var/state get network."$name".device 2>/dev/null) if [ -n "$IFNAME" ]; then if [ -n "$MATCH_SET" ]; then - $NFT insert rule inet ss_spec ss_spec_prerouting iifname "$IFNAME" tcp dport $EXT_ARGS $MATCH_SET comment "\"$TAG\"" jump ss_spec_wan_ac 2>/dev/null + $NFT insert rule inet ss_spec ss_spec_prerouting meta iifname "$IFNAME" meta l4proto tcp th dport { $EXT_ARGS } $MATCH_SET jump ss_spec_wan_ac comment "\"$TAG\"" 2>/dev/null else - $NFT insert rule inet ss_spec ss_spec_prerouting iifname "$IFNAME" tcp dport $EXT_ARGS comment "\"$TAG\"" jump ss_spec_wan_ac 2>/dev/null + $NFT insert rule inet ss_spec ss_spec_prerouting meta iifname "$IFNAME" meta l4proto tcp th dport { $EXT_ARGS } jump ss_spec_wan_ac comment "\"$TAG\"" 2>/dev/null fi fi done @@ -474,7 +516,7 @@ ac_rule_nft() { case "$OUTPUT" in 1) # create output hook chain & route output traffic into router chain - $NFT add rule inet ss_spec ss_spec_output tcp dport $EXT_ARGS comment "\"$TAG\"" jump ss_spec_wan_ac 2>/dev/null + $NFT insert rule inet ss_spec ss_spec_output meta l4proto tcp th dport { $EXT_ARGS } jump ss_spec_wan_ac comment "\"$TAG\"" 2>/dev/null ;; 2) # router mode output chain: create ssr_gen_router set & router chain @@ -485,7 +527,7 @@ ac_rule_nft() { $NFT add chain inet ss_spec ss_spec_router 2>/dev/null $NFT add rule inet ss_spec ss_spec_router ip daddr @ssr_gen_router return 2>/dev/null $NFT add rule inet ss_spec ss_spec_router jump ss_spec_wan_fw 2>/dev/null - $NFT add rule inet ss_spec ss_spec_output tcp dport $EXT_ARGS comment "\"$TAG\"" jump ss_spec_router 2>/dev/null + $NFT add rule inet ss_spec ss_spec_output meta l4proto tcp th dport { $EXT_ARGS } jump ss_spec_router comment "\"$TAG\"" 2>/dev/null ;; esac return 0 @@ -549,89 +591,180 @@ tp_rule() { } tp_rule_nft() { - [ -n "$TPROXY" ] || return 0 - # set up routing table for tproxy ip rule add fwmark 0x01/0x01 table 100 2>/dev/null ip route add local 0.0.0.0/0 dev lo table 100 2>/dev/null # create mangle table and tproxy chain - $NFT add table ip ss_spec_mangle 2>/dev/null + if ! $NFT list table ip ss_spec_mangle >/dev/null 2>&1; then + $NFT add table ip ss_spec_mangle 2>/dev/null + fi + + local MATCH_SET="" + local EXT_ARGS="" + + if [ -n "$PROXY_PORTS" ]; then + EXT_ARGS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') + fi + + if [ -n "$LAN_AC_IP" ]; then + # Create LAN access control set if needed + if ! $NFT list set ip ss_spec_mangle ss_spec_lan_ac >/dev/null 2>&1; then + $NFT add set ip ss_spec_mangle ss_spec_lan_ac '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null + else + $NFT flush set ip ss_spec_mangle ss_spec_lan_ac 2>/dev/null + fi + + for ip in ${LAN_AC_IP#?}; do + [ -n "$ip" ] && $NFT add element ip ss_spec_mangle ss_spec_lan_ac "{ $ip }" 2>/dev/null + done + + case "${LAN_AC_IP%${LAN_AC_IP#?}}" in + w | W) + MATCH_SET="ip saddr @ss_spec_lan_ac" + ;; + b | B) + MATCH_SET="ip saddr != @ss_spec_lan_ac" + ;; + *) + loger 3 "Bad argument \`-a $LAN_AC_IP\`." + return 2 + ;; + esac + fi + + # Create necessary collections + for setname in china gmlan fplan bplan whitelist; do + if ! $NFT list set ip ss_spec_mangle $setname >/dev/null 2>&1; then + $NFT add set ip ss_spec_mangle $setname '{ type ipv4_addr; flags interval; auto-merge; }' + else + $NFT flush set ip ss_spec_mangle $setname 2>/dev/null + fi + done + + # 批量导入中国IP列表 + if [ -f "${china_ip:=/etc/ssrplus/china_ssr.txt}" ]; then + $NFT add element ip ss_spec_mangle china "{ $(tr '\n' ',' < "${china_ip}" | sed 's/,$//') }" 2>/dev/null + fi + # use priority mangle for compatibility with other rules - $NFT add chain ip ss_spec_mangle ss_spec_tproxy '{ type filter hook prerouting priority mangle; }' 2>/dev/null + if ! $NFT list chain ip ss_spec_mangle ss_spec_tproxy >/dev/null 2>&1; then + $NFT add chain ip ss_spec_mangle ss_spec_tproxy 2>/dev/null + else + $NFT flush chain ip ss_spec_mangle ss_spec_tproxy 2>/dev/null + fi # basic return rules in tproxy chain $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport 53 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 0.0.0.0/8 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 10.0.0.0/8 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 127.0.0.0/8 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 169.254.0.0/16 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 172.16.0.0/12 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 192.168.0.0/16 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 224.0.0.0/4 return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr 240.0.0.0/4 return 2>/dev/null + + if $NFT list chain ip ss_spec_mangle ss_spec_tproxy >/dev/null 2>&1; then + for net in 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4; do + $NFT add rule ip ss_spec_mangle ss_spec_tproxy ip daddr $net return 2>/dev/null + done + fi # avoid redirecting to udp server address - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport != 53 ip daddr "$server" return 2>/dev/null + if [ -n "$server" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport != 53 ip daddr "$server" return 2>/dev/null + fi # if server != SERVER add SERVER to whitelist set (so tproxy won't touch it) - if [ "$server" != "$SERVER" ]; then - $NFT add element inet ss_spec whitelist "{ $SERVER }" 2>/dev/null + if [ -n "$server" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy ip daddr "$server" return 2>/dev/null + fi + if [ -n "$SERVER" ] && [ "$server" != "$SERVER" ]; then + $NFT add element ip ss_spec_mangle whitelist "{ $SERVER }" 2>/dev/null fi # access control and tproxy rules - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip saddr @bplan return 2>/dev/null - if [ -n "$PROXY_PORTS" ]; then - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } ip saddr @fplan tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip saddr @bplan return 2>/dev/null + + if [ -n "$EXT_ARGS" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } ip saddr @fplan tproxy to :"$LOCAL_PORT" meta mark set 0x01 else - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip saddr @fplan tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip saddr @fplan tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null fi - + # Handle different run modes for nftables case "$RUNMODE" in router) - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr @ss_spec_wan_ac return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr @china return 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport 80 drop 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip saddr @gmlan ip daddr != @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null - if [ -n "$PROXY_PORTS" ]; then - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } ip daddr != @ss_spec_wan_ac tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if ! $NFT list set ip ss_spec_mangle ss_spec_wan_ac >/dev/null 2>&1; then + $NFT add set ip ss_spec_mangle ss_spec_wan_ac '{ type ipv4_addr; flags interval; auto-merge; }' else - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr != @ss_spec_wan_ac tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT flush set ip ss_spec_mangle ss_spec_wan_ac 2>/dev/null + fi + # Add special IP ranges to WAN AC set + for ip in $(gen_spec_iplist); do + [ -n "$ip" ] && $NFT add element ip ss_spec_mangle ss_spec_wan_ac "{ $ip }" 2>/dev/null + done + + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip daddr @ss_spec_wan_ac return 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip daddr @china return 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport 80 drop 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip saddr @gmlan ip daddr != @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if [ -n "$EXT_ARGS" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } ip daddr != @ss_spec_wan_ac tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + else + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip daddr != @ss_spec_wan_ac tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null fi ;; gfw) - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip daddr @china return 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip daddr @china return 2>/dev/null $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport 80 drop 2>/dev/null - if [ -n "$PROXY_PORTS" ]; then - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } ip daddr @gfwlist tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if [ -n "$EXT_ARGS" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } ip daddr @gfwlist tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null fi - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip saddr @gmlan ip daddr != @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip saddr @gmlan ip daddr != @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null ;; oversea) - if [ -n "$PROXY_PORTS" ]; then - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } ip saddr @oversea tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } ip daddr @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if ! $NFT list set ip ss_spec_mangle oversea >/dev/null 2>&1; then + $NFT add set ip ss_spec_mangle oversea '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null fi - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp ip saddr @gmlan tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if ! $NFT list set ip ss_spec_mangle china >/dev/null 2>&1; then + $NFT add set ip ss_spec_mangle china '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null + fi + if [ -n "$EXT_ARGS" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } ip saddr @oversea tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } ip daddr @china tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + fi + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp ip saddr @gmlan tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null ;; all) - if [ -n "$PROXY_PORTS" ]; then - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $PORTS } tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + if [ -n "$EXT_ARGS" ]; then + $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp dport { $EXT_ARGS } tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null else - $NFT add rule ip ss_spec_mangle ss_spec_tproxy udp tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null + $NFT add rule ip ss_spec_mangle ss_spec_tproxy meta l4proto udp tproxy to :"$LOCAL_PORT" meta mark set 0x01 2>/dev/null fi ;; esac - # insert jump from ip prerouting to our tproxy chain - PORTS=$(echo "$PROXY_PORTS" | sed 's/-m multiport --dports //') - $NFT add rule ip ss_spec_mangle prerouting udp dport { $PORTS } comment "\"$TAG\"" jump ss_spec_tproxy 2>/dev/null + # 创建 prerouting 链(hook prerouting) + if ! $NFT list chain ip ss_spec_mangle prerouting >/dev/null 2>&1; then + $NFT add chain ip ss_spec_mangle prerouting '{ type filter hook prerouting priority mangle; policy accept; }' + fi + + # 添加规则到 prerouting 链 + if [ -z "$Interface" ]; then + # 全局规则 + if [ -n "$MATCH_SET" ]; then + $NFT add rule ip ss_spec_mangle prerouting udp dport { $EXT_ARGS } $MATCH_SET jump ss_spec_tproxy comment "\"$TAG\"" 2>/dev/null + else + $NFT add rule ip ss_spec_mangle prerouting udp dport { $EXT_ARGS } jump ss_spec_tproxy comment "\"$TAG\"" 2>/dev/null + fi + else + # 指定接口 + for name in $Interface; do + IFNAME=$(uci -P /var/state get network."$name".ifname 2>/dev/null) + [ -z "$IFNAME" ] && IFNAME=$(uci -P /var/state get network."$name".device 2>/dev/null) + if [ -n "$IFNAME" ]; then + if [ -n "$MATCH_SET" ]; then + $NFT add rule ip ss_spec_mangle prerouting meta iifname "$IFNAME" udp dport { $EXT_ARGS } $MATCH_SET jump ss_spec_tproxy comment "\"$TAG\"" 2>/dev/null + else + $NFT add rule ip ss_spec_mangle prerouting meta iifname "$IFNAME" udp dport { $EXT_ARGS } jump ss_spec_tproxy comment "\"$TAG\"" 2>/dev/null + fi + fi + done + fi return $? } @@ -734,12 +867,12 @@ gen_include_nft() { [ -n "$FWI" ] && echo '#!/bin/sh' >"$FWI" cat <<-'EOF' >>"$FWI" # Clear existing ss_spec tables - nft add table inet ss_spec 2>/dev/null - nft add table ip ss_spec 2>/dev/null - nft add table ip ss_spec_mangle 2>/dev/null + nft delete table inet ss_spec 2>/dev/null + nft delete table ip ss_spec 2>/dev/null + nft delete table ip ss_spec_mangle 2>/dev/null # Restore shadowsocks nftables rules - nft list ruleset | awk '/table (inet|ip) ss_spec/{flag=1} flag' + nft list ruleset | awk '/^table (inet|ip) ss_spec/{flag=1} /^table / && !/^table (inet|ip) ss_spec/{flag=0} flag' EOF chmod +x "$FWI" } @@ -867,7 +1000,7 @@ case "$TPROXY" in ;; esac -# 首先检查nftables是否正常工作 +# First check whether nftables is working properly if [ "$USE_NFT" = "1" ]; then if ! $NFT list tables 2>/dev/null; then loger 3 "nftables is not working properly, check if nftables is installed and running" diff --git a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh index a15adc0aab..4015644f92 100755 --- a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh +++ b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh @@ -1,22 +1,7 @@ #!/bin/sh [ -f "$1" ] && china_ip=$1 - -if command -v nft >/dev/null 2>&1; then - # 确保表和集合存在 - nft add table inet ss_spec 2>/dev/null - nft add set inet ss_spec china '{ type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null - nft flush set inet ss_spec china 2>/dev/null - - # 批量导入 - if [ -f "${china_ip:=/etc/ssrplus/china_ssr.txt}" ]; then - echo "批量导入中国IP列表..." - nft add element inet ss_spec china { $(tr '\n' ',' < "${china_ip}" | sed 's/,$//') } 2>/dev/null - echo "中国IP集合导入完成" - fi -else - ipset -! flush china 2>/dev/null - ipset -! -R <<-EOF || exit 1 - create china hash:net - $(cat ${china_ip:=/etc/ssrplus/china_ssr.txt} | sed -e "s/^/add china /") +ipset -! flush china 2>/dev/null +ipset -! -R <<-EOF || exit 1 + create china hash:net + $(cat ${china_ip:=/etc/ssrplus/china_ssr.txt} | sed -e "s/^/add china /") EOF -fi diff --git a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh index 8c1f07b398..33808ccc6d 100755 --- a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh +++ b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh @@ -2,14 +2,18 @@ . $IPKG_INSTROOT/etc/init.d/shadowsocksr +if command -v nft >/dev/null 2>&1; then + nft_support=1 +fi + netflix() { if [ -f "$TMP_DNSMASQ_PATH/gfw_list.conf" ]; then for line in $(cat /etc/ssrplus/netflix.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done for line in $(cat /etc/ssrplus/netflix.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done fi - if command -v nft >/dev/null 2>&1; then + if [ "$nft_support" = "1" ]; then # 移除 ipset - cat /etc/ssrplus/netflix.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$1/" >$TMP_DNSMASQ_PATH/netflix_forward.conf + cat /etc/ssrplus/netflix.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$1\nnftset=\/&\/4#inet#ss_spec#netflix/" >$TMP_DNSMASQ_PATH/netflix_forward.conf else cat /etc/ssrplus/netflix.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$1\nipset=\/&\/netflix/" >$TMP_DNSMASQ_PATH/netflix_forward.conf fi @@ -22,11 +26,11 @@ else cp -rf /etc/ssrplus/gfw_base.conf $TMP_DNSMASQ_PATH/ fi -if command -v nft >/dev/null 2>&1; then +if [ "$nft_support" = "1" ]; then # 移除 ipset 指令 for conf_file in gfw_base.conf gfw_list.conf; do if [ -f "$TMP_DNSMASQ_PATH/$conf_file" ]; then - sed -i '/ipset=/d' "$TMP_DNSMASQ_PATH/$conf_file" + sed -i 's|ipset=/\([^/]*\)/\([^[:space:]]*\)|nftset=/\1/4#inet#ss_spec#\2|g' "$TMP_DNSMASQ_PATH/$conf_file" fi done fi @@ -59,9 +63,9 @@ while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done < /e while read line; do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done < /etc/ssrplus/deny.list # 此处直接使用 cat 因为有 sed '/#/d' 删除了 数据 -if command -v nft >/dev/null 2>&1; then - cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$dns_port/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf - cat /etc/ssrplus/white.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1/" >$TMP_DNSMASQ_PATH/whitelist_forward.conf +if [ "$nft_support" = "1" ]; then + cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$dns_port\nnftset=\/&\/4#inet#ss_spec#blacklist/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf + cat /etc/ssrplus/white.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1\nnftset=\/&\/4#inet#ss_spec#whitelist/" >$TMP_DNSMASQ_PATH/whitelist_forward.conf else cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$dns_port\nipset=\/&\/blacklist/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf cat /etc/ssrplus/white.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1\nipset=\/&\/whitelist/" >$TMP_DNSMASQ_PATH/whitelist_forward.conf diff --git a/v2rayn/v2rayN/ServiceLib/Common/Utils.cs b/v2rayn/v2rayN/ServiceLib/Common/Utils.cs index 1712b40c8d..fe2b154911 100644 --- a/v2rayn/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayn/v2rayN/ServiceLib/Common/Utils.cs @@ -425,7 +425,7 @@ public class Utils var domain = authority; // Handle IPv6 addresses, e.g., "[2001:db8::1]:443" - if (authority.StartsWith("[") && authority.Contains("]")) + if (authority.StartsWith('[') && authority.Contains(']')) { var closingBracketIndex = authority.LastIndexOf(']'); if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':') diff --git a/v2rayn/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs b/v2rayn/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs index dbecdade65..ae8377933e 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/Fmt/SocksFmt.cs @@ -45,18 +45,18 @@ public class SocksFmt : BaseFmt }; result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..]; //remark - var indexRemark = result.IndexOf("#"); + var indexRemark = result.IndexOf('#'); if (indexRemark > 0) { try { - item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1, result.Length - indexRemark - 1)); + item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1)); } catch { } result = result[..indexRemark]; } //part decode - var indexS = result.IndexOf("@"); + var indexS = result.IndexOf('@'); if (indexS > 0) { } diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index f9d9493e17..03c3811490 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2355,6 +2355,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Press ESC to terminate the test 的本地化字符串。 + /// + public static string SpeedtestingPressEscToExit { + get { + return ResourceManager.GetString("SpeedtestingPressEscToExit", resourceCulture); + } + } + /// /// 查找类似 Skip test 的本地化字符串。 /// @@ -2383,7 +2392,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 Waiting for testing (press ESC to terminate)... 的本地化字符串。 + /// 查找类似 Waiting... 的本地化字符串。 /// public static string SpeedtestingWait { get { diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 67504966af..f495cebb31 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -976,7 +976,10 @@ فعال‌ سازی شتاب‌ دهنده سخت‌ افزاری (نیاز به راه‌اندازی مجدد) - در انتظار آزمایش (برای پایان دادن به ESC فشار دهید)... + در انتظار آزمایش... + + + برای پایان دادن به ESC فشار دهید لطفاً در صورت قطع غیرعادی آن را خاموش کنید diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fr.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fr.resx index 50a488e0d2..32a2c58583 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fr.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.fr.resx @@ -976,7 +976,10 @@ Activer l’accélération matérielle (redémarrage requis) - En attente du test (appuyer sur Échap pour arrêter)... + En attente du test... + + + Appuyer sur Échap pour arrêter Désactiver cette option si coupure anormale diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.hu.resx index c71e741fb6..4df5e94b82 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -976,7 +976,10 @@ Hardveres gyorsítás engedélyezése (újraindítást igényel) - Tesztelésre vár (ESC megnyomásával megszakítható)... + Tesztelésre vár... + + + ESC megnyomásával megszakítható Kérjük, kapcsolja ki rendellenes megszakadás esetén diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.resx index 66381a9059..785f13a337 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.resx @@ -976,7 +976,10 @@ Enable hardware acceleration (requires restart) - Waiting for testing (press ESC to terminate)... + Waiting... + + + Press ESC to terminate the test Please turn off when there is an abnormal disconnection diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 2694db037f..4ba40e5424 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -976,7 +976,10 @@ Включить аппаратное ускорение (требуется перезагрузка) - Ожидание тестирования (нажмите ESC для отмены)… + Ожидание тестирования… + + + нажмите ESC для отмены Отключите при аномальном разрыве соединения diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 2f3d06222a..df77a6e88b 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -976,7 +976,10 @@ 启用硬件加速 (需重启) - 等待测试中 (按 ESC 终止)... + 等待测试... + + + 按 ESC 可终止测试 当有异常断流时请关闭 diff --git a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index d8d5a7106b..f69ff6ff39 100644 --- a/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayn/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -976,7 +976,10 @@ 啟用硬體加速 (需重啟) - 等待測試中(按 ESC 終止)... + 等待測試中... + + + 按 ECS 以終止測試 當有異常斷流時請關閉 diff --git a/v2rayn/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs b/v2rayn/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs index 87cb7c335e..b77a227bf6 100644 --- a/v2rayn/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs +++ b/v2rayn/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs @@ -300,7 +300,7 @@ public partial class CoreConfigSingboxService private bool ParseV2Domain(string domain, Rule4Sbox rule) { - if (domain.StartsWith("#") || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:")) + if (domain.StartsWith('#') || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:")) { return false; } diff --git a/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs index 600ba4d1d7..00f54427cd 100644 --- a/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs +++ b/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs @@ -19,7 +19,7 @@ public class SpeedtestService(Config config, Func updateF public void ExitLoop() { - if (_lstExitLoop.Count > 0) + if (!_lstExitLoop.IsEmpty) { _ = UpdateFunc("", ResUI.SpeedtestingStop); @@ -27,6 +27,11 @@ public class SpeedtestService(Config config, Func updateF } } + private static bool ShouldStopTest(string exitLoopKey) + { + return !_lstExitLoop.Any(p => p == exitLoopKey); + } + private async Task RunAsync(ESpeedActionType actionType, List selecteds) { var exitLoopKey = Utils.GetGuid(false); @@ -103,6 +108,11 @@ public class SpeedtestService(Config config, Func updateF } } + if (lstSelected.Count > 1 && (actionType == ESpeedActionType.Speedtest || actionType == ESpeedActionType.Mixedtest)) + { + NoticeManager.Instance.Enqueue(ResUI.SpeedtestingPressEscToExit); + } + return lstSelected; } @@ -152,7 +162,7 @@ public class SpeedtestService(Config config, Func updateF var pageSizeNext = pageSize / 2; if (lstFailed.Count > 0 && pageSizeNext > 0) { - if (_lstExitLoop.Any(p => p == exitLoopKey) == false) + if (ShouldStopTest(exitLoopKey)) { await UpdateFunc("", ResUI.SpeedtestingSkip); return; @@ -190,6 +200,12 @@ public class SpeedtestService(Config config, Func updateF { continue; } + + if (ShouldStopTest(exitLoopKey)) + { + return false; + } + tasks.Add(Task.Run(async () => { await DoRealPing(it); @@ -218,7 +234,7 @@ public class SpeedtestService(Config config, Func updateF List tasks = new(); foreach (var it in selecteds) { - if (_lstExitLoop.Any(p => p == exitLoopKey) == false) + if (ShouldStopTest(exitLoopKey)) { await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); continue; @@ -234,21 +250,27 @@ public class SpeedtestService(Config config, Func updateF if (processService is null) { await UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore); + return; } - else + + await Task.Delay(1000); + + var delay = await DoRealPing(it); + if (blSpeedTest) { - await Task.Delay(1000); - var delay = await DoRealPing(it); - if (blSpeedTest) + if (ShouldStopTest(exitLoopKey)) { - if (delay > 0) - { - await DoSpeedTest(downloadHandle, it); - } - else - { - await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); - } + await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); + return; + } + + if (delay > 0) + { + await DoSpeedTest(downloadHandle, it); + } + else + { + await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); } } } diff --git a/v2rayng/V2rayNG/app/build.gradle.kts b/v2rayng/V2rayNG/app/build.gradle.kts index 7512c1600c..30e76fc971 100644 --- a/v2rayng/V2rayNG/app/build.gradle.kts +++ b/v2rayng/V2rayNG/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "com.v2ray.ang" minSdk = 21 targetSdk = 35 - versionCode = 678 - versionName = "1.10.27" + versionCode = 679 + versionName = "1.10.28" multiDexEnabled = true val abiFilterList = (properties["ABI_FILTERS"] as? String)?.split(';') diff --git a/v2rayng/V2rayNG/app/src/main/assets/custom_routing_black b/v2rayng/V2rayNG/app/src/main/assets/custom_routing_black index f15daacd64..5fbdb8b631 100644 --- a/v2rayng/V2rayNG/app/src/main/assets/custom_routing_black +++ b/v2rayng/V2rayNG/app/src/main/assets/custom_routing_black @@ -6,20 +6,19 @@ "bittorrent" ] }, - { - "remarks": "Google cn", - "outboundTag": "proxy", - "domain": [ - "domain:googleapis.cn", - "domain:gstatic.com" - ] - }, { "remarks": "阻断udp443", "outboundTag": "block", "port": "443", "network": "udp" }, + { + "remarks": "代理Google", + "outboundTag": "proxy", + "domain": [ + "geosite:google" + ] + }, { "remarks": "绕过局域网IP", "outboundTag": "direct", @@ -139,4 +138,4 @@ "port": "0-65535", "outboundTag": "direct" } -] \ No newline at end of file +] diff --git a/v2rayng/V2rayNG/app/src/main/assets/custom_routing_white b/v2rayng/V2rayNG/app/src/main/assets/custom_routing_white index e3c360c0f4..4f8540fea9 100644 --- a/v2rayng/V2rayNG/app/src/main/assets/custom_routing_white +++ b/v2rayng/V2rayNG/app/src/main/assets/custom_routing_white @@ -1,18 +1,17 @@ [ - { - "remarks": "Google cn", - "outboundTag": "proxy", - "domain": [ - "domain:googleapis.cn", - "domain:gstatic.com" - ] - }, { "remarks": "阻断udp443", "outboundTag": "block", "port": "443", "network": "udp" }, + { + "remarks": "代理Google", + "outboundTag": "proxy", + "domain": [ + "geosite:google" + ] + }, { "remarks": "绕过局域网IP", "outboundTag": "direct", @@ -93,4 +92,4 @@ "geosite:cn" ] } -] \ No newline at end of file +] diff --git a/yt-dlp/yt_dlp/downloader/common.py b/yt-dlp/yt_dlp/downloader/common.py index 122c479562..6f15607c27 100644 --- a/yt-dlp/yt_dlp/downloader/common.py +++ b/yt-dlp/yt_dlp/downloader/common.py @@ -461,7 +461,8 @@ class FileDownloader: min_sleep_interval = self.params.get('sleep_interval') or 0 max_sleep_interval = self.params.get('max_sleep_interval') or 0 - if available_at := info_dict.get('available_at'): + requested_formats = info_dict.get('requested_formats') or [info_dict] + if available_at := max(f.get('available_at') or 0 for f in requested_formats): forced_sleep_interval = available_at - int(time.time()) if forced_sleep_interval > min_sleep_interval: sleep_note = 'as required by the site' diff --git a/yt-dlp/yt_dlp/extractor/_extractors.py b/yt-dlp/yt_dlp/extractor/_extractors.py index f4eb00f059..848b608717 100644 --- a/yt-dlp/yt_dlp/extractor/_extractors.py +++ b/yt-dlp/yt_dlp/extractor/_extractors.py @@ -2523,6 +2523,7 @@ from .yappy import ( YappyIE, YappyProfileIE, ) +from .yfanefa import YfanefaIE from .yle_areena import YleAreenaIE from .youjizz import YouJizzIE from .youku import ( diff --git a/yt-dlp/yt_dlp/extractor/soundcloud.py b/yt-dlp/yt_dlp/extractor/soundcloud.py index 7833081bfa..5c3ff28c6d 100644 --- a/yt-dlp/yt_dlp/extractor/soundcloud.py +++ b/yt-dlp/yt_dlp/extractor/soundcloud.py @@ -1064,7 +1064,7 @@ class SoundcloudRelatedIE(SoundcloudPagedPlaylistBaseIE): class SoundcloudPlaylistIE(SoundcloudPlaylistBaseIE): - _VALID_URL = r'https?://api(?:-v2)?\.soundcloud\.com/playlists/(?P[0-9]+)(?:/?\?secret_token=(?P[^&]+?))?$' + _VALID_URL = r'https?://api(?:-v2)?\.soundcloud\.com/playlists/(?:soundcloud(?:%3A|:)playlists(?:%3A|:))?(?P[0-9]+)(?:/?\?secret_token=(?P[^&]+?))?$' IE_NAME = 'soundcloud:playlist' _TESTS = [{ 'url': 'https://api.soundcloud.com/playlists/4110309', @@ -1079,6 +1079,12 @@ class SoundcloudPlaylistIE(SoundcloudPlaylistBaseIE): 'album': 'TILT Brass - Bowery Poetry Club, August \'03 [Non-Site SCR 02]', }, 'playlist_count': 6, + }, { + 'url': 'https://api.soundcloud.com/playlists/soundcloud%3Aplaylists%3A1759227795', + 'only_matching': True, + }, { + 'url': 'https://api.soundcloud.com/playlists/soundcloud:playlists:2104769627?secret_token=s-wmpCLuExeYX', + 'only_matching': True, }] def _real_extract(self, url): diff --git a/yt-dlp/yt_dlp/extractor/yfanefa.py b/yt-dlp/yt_dlp/extractor/yfanefa.py new file mode 100644 index 0000000000..f1c340982a --- /dev/null +++ b/yt-dlp/yt_dlp/extractor/yfanefa.py @@ -0,0 +1,67 @@ +from .common import InfoExtractor +from ..utils import ( + determine_ext, + int_or_none, + join_nonempty, + remove_end, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class YfanefaIE(InfoExtractor): + IE_NAME = 'yfanefa' + _VALID_URL = r'https?://(?:www\.)?yfanefa\.com/(?P[^?#]+)' + _TESTS = [{ + 'url': 'https://www.yfanefa.com/record/2717', + 'info_dict': { + 'id': 'record-2717', + 'ext': 'mp4', + 'title': 'THE HALLAMSHIRE RIFLES LEAVING SHEFFIELD, 1914', + 'duration': 5239, + 'thumbnail': r're:https://media\.yfanefa\.com/storage/v1/file/', + }, + }, { + 'url': 'https://www.yfanefa.com/news/53', + 'info_dict': { + 'id': 'news-53', + 'ext': 'mp4', + 'title': 'Memory Bank: Bradford Launch', + 'thumbnail': r're:https://media\.yfanefa\.com/storage/v1/file/', + }, + }, { + 'url': 'https://www.yfanefa.com/evaluating_nature_matters', + 'info_dict': { + 'id': 'evaluating_nature_matters', + 'ext': 'mp4', + 'title': 'Evaluating Nature Matters', + 'thumbnail': r're:https://media\.yfanefa\.com/storage/v1/file/', + }, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + + webpage = self._download_webpage(url, video_id) + player_data = self._search_json( + r'iwPlayer\.options\["[\w.]+"\]\s*=', webpage, 'player options', video_id) + + formats = [] + video_url = join_nonempty(player_data['url'], player_data.get('signature'), delim='') + if determine_ext(video_url) == 'm3u8': + formats = self._extract_m3u8_formats( + video_url, video_id, 'mp4', m3u8_id='hls') + else: + formats = [{'url': video_url, 'ext': 'mp4'}] + + return { + 'id': video_id.strip('/').replace('/', '-'), + 'title': + self._og_search_title(webpage, default=None) + or remove_end(self._html_extract_title(webpage), ' | Yorkshire Film Archive'), + 'formats': formats, + **traverse_obj(player_data, { + 'thumbnail': ('preview', {url_or_none}), + 'duration': ('duration', {int_or_none}), + }), + }