From af75f1ce4fc4538dde42a07db781ebbd160beaab Mon Sep 17 00:00:00 2001 From: putyy Date: Fri, 25 Jul 2025 11:46:07 +0800 Subject: [PATCH] feat: insert mode setting --- core/config.go | 5 +++++ core/system_linux.go | 2 +- frontend/src/components/Preview.vue | 1 - frontend/src/locales/en.json | 2 ++ frontend/src/locales/zh.json | 2 ++ frontend/src/stores/index.ts | 1 + frontend/src/types/app.d.ts | 1 + frontend/src/views/index.vue | 6 +++++- frontend/src/views/setting.vue | 12 ++++++++++++ 9 files changed, 29 insertions(+), 3 deletions(-) diff --git a/core/config.go b/core/config.go index 365dcf2..25ff085 100644 --- a/core/config.go +++ b/core/config.go @@ -35,6 +35,7 @@ type Config struct { DownNumber int `json:"DownNumber"` UserAgent string `json:"UserAgent"` UseHeaders string `json:"UseHeaders"` + InsertTail bool `json:"InsertTail"` MimeMap map[string]MimeInfo `json:"MimeMap"` } @@ -65,6 +66,7 @@ func initConfig() *Config { DownNumber: 3, UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36", UseHeaders: "User-Agent,Referer,Authorization,Cookie", + InsertTail: true, MimeMap: getDefaultMimeMap(), } @@ -220,6 +222,7 @@ func (c *Config) setConfig(config Config) { c.DownNumber = config.DownNumber c.WxAction = config.WxAction c.UseHeaders = config.UseHeaders + c.InsertTail = config.InsertTail if oldProxy != c.UpstreamProxy || openProxy != c.OpenProxy { proxyOnce.setTransport() } @@ -270,6 +273,8 @@ func (c *Config) getConfig(key string) interface{} { return c.WxAction case "UseHeaders": return c.UseHeaders + case "InsertTail": + return c.InsertTail case "MimeMap": mimeMux.RLock() defer mimeMux.RUnlock() diff --git a/core/system_linux.go b/core/system_linux.go index d379c0d..5836341 100644 --- a/core/system_linux.go +++ b/core/system_linux.go @@ -117,7 +117,7 @@ func (s *SystemSetup) installCert() (string, error) { confPath := "/etc/ca-certificates.conf" checkCmd := []string{"grep", "-qxF", certName, confPath} if _, err := s.runCommand(checkCmd, true); err != nil { - echoCmd := []string{"bash", "-c", fmt.Sprintf("echo '%s' >> %s", appOnce.AppName+"/"+certName, confPath)} + echoCmd := []string{"bash", "-c", fmt.Sprintf("echo '%s/%s' >> %s", appOnce.AppName, certName, confPath)} if output, err := s.runCommand(echoCmd, true); err != nil { errs.WriteString(fmt.Sprintf("append conf failed: %s\n%s\n", err.Error(), output)) } else { diff --git a/frontend/src/components/Preview.vue b/frontend/src/components/Preview.vue index 509eb03..3c4f23c 100644 --- a/frontend/src/components/Preview.vue +++ b/frontend/src/components/Preview.vue @@ -141,7 +141,6 @@ const buildUrlWithParams = (url: string) => { } const handleSeeking = () => { - console.log('handleSeeking') const currentTime = videoPlayer.value.currentTime const bufferedEnd = videoPlayer.value.buffered.end(videoPlayer.value.buffered.length - 1) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index a8f595d..232ee88 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -96,6 +96,8 @@ "quality_tip": "Effective for video accounts", "full_intercept": "Full Intercept", "full_intercept_tip": "Whether to fully intercept WeChat video accounts, No: only intercept video details", + "insert_tail": "insert tail", + "insert_tail_tip": "Intercept whether new data is added to the end of the list", "upstream_proxy": "Upstream Proxy", "upstream_proxy_tip": "For combining with other proxy tools, format: http://username:password@your.proxy.server:port", "download_proxy": "Download Proxy", diff --git a/frontend/src/locales/zh.json b/frontend/src/locales/zh.json index 866538e..8b489e9 100644 --- a/frontend/src/locales/zh.json +++ b/frontend/src/locales/zh.json @@ -96,6 +96,8 @@ "quality_tip": "视频号有效", "full_intercept": "全量拦截", "full_intercept_tip": "微信视频号是否全量拦截,否:只拦截视频详情", + "insert_tail": "添入尾部", + "insert_tail_tip": "拦截到新数据是否添加到列表尾部", "upstream_proxy": "上游代理", "upstream_proxy_tip": "用于结合其他代理工具,格式: http://username:password@your.proxy.server:port", "download_proxy": "下载代理", diff --git a/frontend/src/stores/index.ts b/frontend/src/stores/index.ts index 68c188d..215a33d 100644 --- a/frontend/src/stores/index.ts +++ b/frontend/src/stores/index.ts @@ -32,6 +32,7 @@ export const useIndexStore = defineStore("index-store", () => { DownNumber: 3, UserAgent: "", UseHeaders: "", + InsertTail: true, MimeMap: {} }) diff --git a/frontend/src/types/app.d.ts b/frontend/src/types/app.d.ts index 48a9b2c..f7b74f4 100644 --- a/frontend/src/types/app.d.ts +++ b/frontend/src/types/app.d.ts @@ -29,6 +29,7 @@ export namespace appType { DownNumber: number UserAgent: string UseHeaders: string + InsertTail: boolean MimeMap: { [key: string]: MimeMap } } diff --git a/frontend/src/views/index.vue b/frontend/src/views/index.vue index c7acbbc..7e82b88 100644 --- a/frontend/src/views/index.vue +++ b/frontend/src/views/index.vue @@ -381,7 +381,11 @@ onMounted(() => { eventStore.addHandle({ type: "newResources", event: (res: appType.MediaInfo) => { - data.value.push(res) + if (store.globalConfig.InsertTail) { + data.value.push(res) + } else { + data.value.unshift(res) + } cacheData() } }) diff --git a/frontend/src/views/setting.vue b/frontend/src/views/setting.vue index aac359b..5216488 100644 --- a/frontend/src/views/setting.vue +++ b/frontend/src/views/setting.vue @@ -64,6 +64,18 @@ {{ t("setting.full_intercept_tip") }} + + + + + + {{ t("setting.insert_tail_tip") }} + +