mirror of
https://github.com/putyy/res-downloader.git
synced 2026-01-12 14:14:55 +08:00
perf: plugin optimize、add dartNode branding image
This commit is contained in:
@@ -45,6 +45,8 @@ Clean UI, easy to use, and supports a wide range of resource sniffing and downlo
|
||||
|
||||

|
||||
|
||||
[]( https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
|
||||
## 🚀 How to Use
|
||||
|
||||
> Follow these steps to use the software correctly:
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||

|
||||
|
||||
[]( https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
|
||||
---
|
||||
|
||||
## 🚀 使用方法
|
||||
|
||||
@@ -14,6 +14,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var qqMediaRegex = regexp.MustCompile(`get\s*media\(\)\{`)
|
||||
var qqCommentRegex = regexp.MustCompile(`async\s*finderGetCommentDetail\((\w+)\)\s*\{return(.*?)\s*}\s*async`)
|
||||
|
||||
type QqPlugin struct {
|
||||
bridge *shared.Bridge
|
||||
}
|
||||
@@ -72,7 +75,7 @@ func (p *QqPlugin) OnResponse(resp *http.Response, ctx *goproxy.ProxyCtx) *http.
|
||||
return respTemp
|
||||
}
|
||||
bodyStr := string(body)
|
||||
newBody := regexp.MustCompile(`get\s*media\(\)\{`).
|
||||
newBody := qqMediaRegex.
|
||||
ReplaceAllString(bodyStr, `
|
||||
get media(){
|
||||
if(this.objectDesc){
|
||||
@@ -85,7 +88,7 @@ func (p *QqPlugin) OnResponse(resp *http.Response, ctx *goproxy.ProxyCtx) *http.
|
||||
|
||||
`)
|
||||
|
||||
newBody = regexp.MustCompile(`async\s*finderGetCommentDetail\((\w+)\)\s*\{return(.*?)\s*}\s*async`).
|
||||
newBody = qqCommentRegex.
|
||||
ReplaceAllString(newBody, `
|
||||
async finderGetCommentDetail($1) {
|
||||
var res = await$2;
|
||||
|
||||
@@ -28,23 +28,26 @@ type Resource struct {
|
||||
|
||||
func initResource() *Resource {
|
||||
if resourceOnce == nil {
|
||||
resourceOnce = &Resource{
|
||||
resType: map[string]bool{
|
||||
"all": true,
|
||||
"image": true,
|
||||
"audio": true,
|
||||
"video": true,
|
||||
"m3u8": true,
|
||||
"live": true,
|
||||
"xls": true,
|
||||
"doc": true,
|
||||
"pdf": true,
|
||||
},
|
||||
}
|
||||
resourceOnce = &Resource{}
|
||||
resourceOnce.resType = resourceOnce.buildResType(globalConfig.MimeMap)
|
||||
}
|
||||
return resourceOnce
|
||||
}
|
||||
|
||||
func (r *Resource) buildResType(mime map[string]MimeInfo) map[string]bool {
|
||||
t := map[string]bool{
|
||||
"all": true,
|
||||
}
|
||||
|
||||
for _, item := range mime {
|
||||
if _, ok := t[item.Type]; !ok {
|
||||
t[item.Type] = true
|
||||
}
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (r *Resource) mediaIsMarked(key string) bool {
|
||||
_, loaded := r.mediaMark.Load(key)
|
||||
return loaded
|
||||
@@ -63,23 +66,17 @@ func (r *Resource) getResType(key string) (bool, bool) {
|
||||
|
||||
func (r *Resource) setResType(n []string) {
|
||||
r.resTypeMux.Lock()
|
||||
defer r.resTypeMux.Unlock()
|
||||
r.resType = map[string]bool{
|
||||
"all": false,
|
||||
"image": false,
|
||||
"audio": false,
|
||||
"video": false,
|
||||
"m3u8": false,
|
||||
"live": false,
|
||||
"xls": false,
|
||||
"doc": false,
|
||||
"pdf": false,
|
||||
for key := range r.resType {
|
||||
r.resType[key] = false
|
||||
}
|
||||
|
||||
for _, value := range n {
|
||||
if _, ok := r.resType[value]; ok {
|
||||
r.resType[value] = true
|
||||
}
|
||||
}
|
||||
r.resTypeMux.Unlock()
|
||||
}
|
||||
|
||||
func (r *Resource) clear() {
|
||||
r.mediaMark.Clear()
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
"connections_tip": "Keep default if unsure, usually CPU cores * 2, for faster downloads",
|
||||
"use_headers_tip": "Define headers for downloads, comma separated",
|
||||
"mime_map": "Intercept Rules",
|
||||
"mime_map_tip": "JSON format, keep default if unsure"
|
||||
"mime_map_tip": "JSON format, keep default if unsure, please restart software after modification"
|
||||
},
|
||||
"footer": {
|
||||
"title": "About Us",
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"filename_rules": "文件命名",
|
||||
"filename_rules_tip": "输入框控制文件命名的长度(不含时间、0为无效,此选项有描述信息时有效),开关控制文件末尾是否添加时间标识",
|
||||
"auto_proxy": "自动拦截",
|
||||
"auto_proxy_tip": "打开软件时动启用拦截",
|
||||
"auto_proxy_tip": "打开软件时自动启用拦截",
|
||||
"quality": "清晰度",
|
||||
"quality_value": "默认(推荐),超清,高画质,中画质,低画质",
|
||||
"quality_tip": "视频号有效",
|
||||
@@ -98,7 +98,7 @@
|
||||
"connections_tip": "如不清楚请保持默认,通常CPU核心数*2,用于加速下载",
|
||||
"use_headers_tip": "定义下载时可使用的header参数,逗号分割",
|
||||
"mime_map": "拦截规则",
|
||||
"mime_map_tip": "json格式,如果不清楚保持默认就行"
|
||||
"mime_map_tip": "json格式,如果不清楚保持默认就行,修改后请重启软件"
|
||||
},
|
||||
"footer": {
|
||||
"title": "关于我们",
|
||||
|
||||
@@ -84,7 +84,7 @@ const classifyAlias: { [key: string]: any } = {
|
||||
m3u8: computed(() => t("index.m3u8")),
|
||||
live: computed(() => t("index.live")),
|
||||
xls: computed(() => t("index.xls")),
|
||||
doc: computed(() => t("index.pdf")),
|
||||
doc: computed(() => t("index.doc")),
|
||||
pdf: computed(() => t("index.pdf")),
|
||||
font: computed(() => t("index.font"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user