Add local YAML file import feature for subscription manager - #33913
Open
kitenium wants to merge 1 commit into
Open
Add local YAML file import feature for subscription manager#33913kitenium wants to merge 1 commit into
kitenium wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
订阅管理器支持本地 YAML 文件导入
概述
在订阅管理器对话框中新增「本地文件导入」标签页,支持上传本地 Clash/Mihomo YAML 配置文件,自动解析并导入代理节点。此前用户只能通过订阅链接或分享链接导入节点,本次更新新增了基于本地文件的第三种导入方式。
新增功能
proxies字段)、纯文本 URI 列表、Base64 编码的 URI 列表本地YAML导入),可在订阅配置管理中统一管理.yaml、.yml、.txt改动详情
后端 (
ss_node_subscribe.sh)subprof_create_local_import_profile()— 创建本地导入的订阅配置 dbus 记录,确保导入节点正确关联到订阅配置start_yaml_file_import()(action "5")— 主导入入口:定位上传文件、校验大小、创建订阅配置、通过sub-tool inspect检测格式并解析,写入 dbus 时关联_profile_idclash-yaml、uri-lines、base64-uri-lines前端 (
Module_shadowsocks.asp)ondragover/ondrop事件(调用preventDefault()阻止浏览器默认下载行为)on_submgr_yaml_file_dropped()— 处理拖拽文件,校验扩展名,暂存文件on_submgr_yaml_file_selected()— 处理点击选择文件submit_subscription_yaml_from_manager()— 通过FormData上传文件至/_upload,完成后触发导入 action "5"Add Local YAML File Import for Subscription Manager
Summary
Add a new "本地文件导入" (Local File Import) tab in the subscription manager dialog, allowing users to upload local Clash/Mihomo YAML configuration files and import proxy nodes directly. Previously, users could only import nodes via subscription URLs or share links — this adds a third entry point for local file-based imports.
What's New
proxiesfield), plain URI lines, or base64-encoded URI blocks本地YAML导入), so they appear in the profiles list and can be managed like regular subscriptions.yaml,.yml,.txtChanges
Backend (
ss_node_subscribe.sh)subprof_create_local_import_profile()— creates a subscription profile dbus record for local file imports so imported nodes are properly associated with a profilestart_yaml_file_import()(action "5") — the main import entry point: locates the uploaded file, validates size, creates a profile, detects format viasub-tool inspect, parses accordingly, and writes nodes to dbus with_profile_idassociationclash-yaml,uri-lines, andbase64-uri-linesFrontend (
Module_shadowsocks.asp)ondragover/ondrophandlers (callspreventDefault()to stop browser from downloading the file)on_submgr_yaml_file_dropped()— handles drag-and-drop file input, validates extension, stores file for uploadon_submgr_yaml_file_selected()— handles click-to-browse file selectionsubmit_subscription_yaml_from_manager()— uploads file viaFormDatato/_upload, then triggers import action "5"