mirror of
https://github.com/putyy/res-downloader.git
synced 2026-01-12 06:04:55 +08:00
feat: insert mode setting
This commit is contained in:
@@ -35,6 +35,7 @@ type Config struct {
|
|||||||
DownNumber int `json:"DownNumber"`
|
DownNumber int `json:"DownNumber"`
|
||||||
UserAgent string `json:"UserAgent"`
|
UserAgent string `json:"UserAgent"`
|
||||||
UseHeaders string `json:"UseHeaders"`
|
UseHeaders string `json:"UseHeaders"`
|
||||||
|
InsertTail bool `json:"InsertTail"`
|
||||||
MimeMap map[string]MimeInfo `json:"MimeMap"`
|
MimeMap map[string]MimeInfo `json:"MimeMap"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ func initConfig() *Config {
|
|||||||
DownNumber: 3,
|
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",
|
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",
|
UseHeaders: "User-Agent,Referer,Authorization,Cookie",
|
||||||
|
InsertTail: true,
|
||||||
MimeMap: getDefaultMimeMap(),
|
MimeMap: getDefaultMimeMap(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +222,7 @@ func (c *Config) setConfig(config Config) {
|
|||||||
c.DownNumber = config.DownNumber
|
c.DownNumber = config.DownNumber
|
||||||
c.WxAction = config.WxAction
|
c.WxAction = config.WxAction
|
||||||
c.UseHeaders = config.UseHeaders
|
c.UseHeaders = config.UseHeaders
|
||||||
|
c.InsertTail = config.InsertTail
|
||||||
if oldProxy != c.UpstreamProxy || openProxy != c.OpenProxy {
|
if oldProxy != c.UpstreamProxy || openProxy != c.OpenProxy {
|
||||||
proxyOnce.setTransport()
|
proxyOnce.setTransport()
|
||||||
}
|
}
|
||||||
@@ -270,6 +273,8 @@ func (c *Config) getConfig(key string) interface{} {
|
|||||||
return c.WxAction
|
return c.WxAction
|
||||||
case "UseHeaders":
|
case "UseHeaders":
|
||||||
return c.UseHeaders
|
return c.UseHeaders
|
||||||
|
case "InsertTail":
|
||||||
|
return c.InsertTail
|
||||||
case "MimeMap":
|
case "MimeMap":
|
||||||
mimeMux.RLock()
|
mimeMux.RLock()
|
||||||
defer mimeMux.RUnlock()
|
defer mimeMux.RUnlock()
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ func (s *SystemSetup) installCert() (string, error) {
|
|||||||
confPath := "/etc/ca-certificates.conf"
|
confPath := "/etc/ca-certificates.conf"
|
||||||
checkCmd := []string{"grep", "-qxF", certName, confPath}
|
checkCmd := []string{"grep", "-qxF", certName, confPath}
|
||||||
if _, err := s.runCommand(checkCmd, true); err != nil {
|
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 {
|
if output, err := s.runCommand(echoCmd, true); err != nil {
|
||||||
errs.WriteString(fmt.Sprintf("append conf failed: %s\n%s\n", err.Error(), output))
|
errs.WriteString(fmt.Sprintf("append conf failed: %s\n%s\n", err.Error(), output))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ const buildUrlWithParams = (url: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSeeking = () => {
|
const handleSeeking = () => {
|
||||||
console.log('handleSeeking')
|
|
||||||
const currentTime = videoPlayer.value.currentTime
|
const currentTime = videoPlayer.value.currentTime
|
||||||
const bufferedEnd = videoPlayer.value.buffered.end(videoPlayer.value.buffered.length - 1)
|
const bufferedEnd = videoPlayer.value.buffered.end(videoPlayer.value.buffered.length - 1)
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,8 @@
|
|||||||
"quality_tip": "Effective for video accounts",
|
"quality_tip": "Effective for video accounts",
|
||||||
"full_intercept": "Full Intercept",
|
"full_intercept": "Full Intercept",
|
||||||
"full_intercept_tip": "Whether to fully intercept WeChat video accounts, No: only intercept video details",
|
"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": "Upstream Proxy",
|
||||||
"upstream_proxy_tip": "For combining with other proxy tools, format: http://username:password@your.proxy.server:port",
|
"upstream_proxy_tip": "For combining with other proxy tools, format: http://username:password@your.proxy.server:port",
|
||||||
"download_proxy": "Download Proxy",
|
"download_proxy": "Download Proxy",
|
||||||
|
|||||||
@@ -96,6 +96,8 @@
|
|||||||
"quality_tip": "视频号有效",
|
"quality_tip": "视频号有效",
|
||||||
"full_intercept": "全量拦截",
|
"full_intercept": "全量拦截",
|
||||||
"full_intercept_tip": "微信视频号是否全量拦截,否:只拦截视频详情",
|
"full_intercept_tip": "微信视频号是否全量拦截,否:只拦截视频详情",
|
||||||
|
"insert_tail": "添入尾部",
|
||||||
|
"insert_tail_tip": "拦截到新数据是否添加到列表尾部",
|
||||||
"upstream_proxy": "上游代理",
|
"upstream_proxy": "上游代理",
|
||||||
"upstream_proxy_tip": "用于结合其他代理工具,格式: http://username:password@your.proxy.server:port",
|
"upstream_proxy_tip": "用于结合其他代理工具,格式: http://username:password@your.proxy.server:port",
|
||||||
"download_proxy": "下载代理",
|
"download_proxy": "下载代理",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const useIndexStore = defineStore("index-store", () => {
|
|||||||
DownNumber: 3,
|
DownNumber: 3,
|
||||||
UserAgent: "",
|
UserAgent: "",
|
||||||
UseHeaders: "",
|
UseHeaders: "",
|
||||||
|
InsertTail: true,
|
||||||
MimeMap: {}
|
MimeMap: {}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
1
frontend/src/types/app.d.ts
vendored
1
frontend/src/types/app.d.ts
vendored
@@ -29,6 +29,7 @@ export namespace appType {
|
|||||||
DownNumber: number
|
DownNumber: number
|
||||||
UserAgent: string
|
UserAgent: string
|
||||||
UseHeaders: string
|
UseHeaders: string
|
||||||
|
InsertTail: boolean
|
||||||
MimeMap: { [key: string]: MimeMap }
|
MimeMap: { [key: string]: MimeMap }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,11 @@ onMounted(() => {
|
|||||||
eventStore.addHandle({
|
eventStore.addHandle({
|
||||||
type: "newResources",
|
type: "newResources",
|
||||||
event: (res: appType.MediaInfo) => {
|
event: (res: appType.MediaInfo) => {
|
||||||
data.value.push(res)
|
if (store.globalConfig.InsertTail) {
|
||||||
|
data.value.push(res)
|
||||||
|
} else {
|
||||||
|
data.value.unshift(res)
|
||||||
|
}
|
||||||
cacheData()
|
cacheData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -64,6 +64,18 @@
|
|||||||
{{ t("setting.full_intercept_tip") }}
|
{{ t("setting.full_intercept_tip") }}
|
||||||
</NTooltip>
|
</NTooltip>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem :label="t('setting.insert_tail')" path="InsertTail">
|
||||||
|
<NSwitch v-model:value="formValue.InsertTail"/>
|
||||||
|
<NTooltip trigger="hover">
|
||||||
|
<template #trigger>
|
||||||
|
<NIcon size="18" class="ml-1 text-gray-500">
|
||||||
|
<HelpCircleOutline/>
|
||||||
|
</NIcon>
|
||||||
|
</template>
|
||||||
|
{{ t("setting.insert_tail_tip") }}
|
||||||
|
</NTooltip>
|
||||||
|
</NFormItem>
|
||||||
</NForm>
|
</NForm>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user