2 |
3 |
更新日志:
4 |
修复生成错误秒传的问题: 23.4.25发布的 2.7.3, 2.7.4 这两个版本会生成错误的秒传, 错误秒传在文件上传者账号正常转存, 但在其他的账号会报错 秒传未生效#404, 出现此问题注意使用当前版本重新生成秒传
5 |
6 |
39 |
40 |
--------------------------------------------------------------------------------
/src/css/app.css:
--------------------------------------------------------------------------------
1 | /*自定义单选框样式*/
2 | .mzf_check {
3 | display: inline-block;
4 | background-color: white;
5 | border-radius: 5px;
6 | border: 1px solid #d3d3d3;
7 | width: 20px;
8 | height: 20px;
9 | text-align: center;
10 | vertical-align: middle;
11 | line-height: 20px;
12 | margin-left: 10px;
13 | }
14 | .mzf_check_ori:checked + .mzf_check {
15 | background-color: #eee;
16 | }
17 | .mzf_check_ori:checked + .mzf_check::after {
18 | content: "✓";
19 | }
20 | .mzf_check_ori {
21 | display: none;
22 | }
23 |
24 | /*新版度盘页面的按钮样式(直接拷贝)*/
25 | .mzf_new_btn {
26 | -webkit-text-size-adjust: 100%;
27 | -webkit-font-smoothing: antialiased;
28 | -webkit-tap-highlight-color: transparent;
29 | vertical-align: middle;
30 | font: inherit;
31 | overflow: visible;
32 | text-transform: none;
33 | font-family: SFUIText, PingFangSC-Regular, Helvetica Neue, Helvetica, Arial,
34 | sans-serif;
35 | display: inline-block;
36 | line-height: 1;
37 | white-space: nowrap;
38 | cursor: pointer;
39 | background: #fff;
40 | text-align: center;
41 | box-sizing: border-box;
42 | outline: 0;
43 | margin: 0;
44 | transition: 0.1s;
45 | color: #fff;
46 | background-color: #06a7ff;
47 | font-weight: 700;
48 | padding: 8px 24px;
49 | height: 32px;
50 | font-size: 14px;
51 | border-radius: 16px;
52 | border: none;
53 | margin-left: 8px;
54 | }
55 |
--------------------------------------------------------------------------------
/src/css/app.scss:
--------------------------------------------------------------------------------
1 | /*按钮样式*/
2 | .mzf_btn {
3 | text-align: center;
4 | font-size: 0.85em;
5 | color: #09aaff;
6 | border: 2px solid #c3eaff;
7 | border-radius: 4px;
8 | margin-left: 5px;
9 | padding: 10px;
10 | padding-top: 5px;
11 | padding-bottom: 5px;
12 | cursor: pointer;
13 | }
14 |
15 | /*按钮样式2*/
16 | .mzf_btn2 {
17 | text-align: center;
18 | color: #09aaff;
19 | margin-left: 5px;
20 | cursor: pointer;
21 | }
22 |
23 | /*超链接样式*/
24 | .mzf_link {
25 | font-family: inherit;
26 | color: #09aaff;
27 | text-decoration: none;
28 | vertical-align: baseline;
29 | }
30 |
31 | /*行样式*/
32 | .mzf_text {
33 | font-feature-settings: "lnum";
34 | -webkit-font-smoothing: antialiased;
35 | font-family: inherit;
36 | color: #545454;
37 | font-weight: 400;
38 | word-break: break-word;
39 | -webkit-tap-highlight-color: transparent;
40 | margin: 0;
41 | padding: 0;
42 | width: 100%;
43 | height: 34px;
44 | display: block;
45 | line-height: 34px;
46 | text-align: center;
47 | white-space: nowrap;
48 | }
49 |
50 | /*折叠框箭头样式*/
51 | .mzf_arrow {
52 | margin-right: 5px;
53 | transform: rotate(180deg);
54 | transition: transform 0.2s;
55 | fill: none;
56 | stroke: gray;
57 | }
58 |
59 | /*折叠框*/
60 | .mzf_details {
61 | cursor: pointer;
62 | }
63 |
64 | .mzf_details summary {
65 | white-space: nowrap;
66 | }
67 |
68 | /*折叠框内容*/
69 | .mzf_content {
70 | max-height: 0;
71 | margin: 0;
72 | transition: max-height 0.5s;
73 | overflow: hidden;
74 | }
75 |
76 | /*折叠框动画*/
77 | .mzf_details[open] {
78 | > summary > svg {
79 | transform: rotate(0deg);
80 | }
81 | + .mzf_content {
82 | max-height: 100%;
83 | }
84 | }
85 |
86 | /*html容器样式*/
87 | .mzf_html_container {
88 | grid-template-columns: minmax(0, 100%);
89 | align-self: center;
90 | justify-self: center;
91 | width: 32em;
92 | max-width: 100%;
93 | }
94 |
95 | .mzf_updateInfo {
96 | border: 1px #000000;
97 | width: 100%;
98 | margin: 0 auto;
99 | }
100 |
101 | .mzf_updateInfo span {
102 | vertical-align: baseline;
103 | }
104 |
--------------------------------------------------------------------------------
/src/types/css.d.ts:
--------------------------------------------------------------------------------
1 | declare module "*.css" {
2 | const content: string;
3 | export default content;
4 | }
5 |
--------------------------------------------------------------------------------
/src/types/html.d.ts:
--------------------------------------------------------------------------------
1 | declare module "*.html" {
2 | const content: string;
3 | export default content;
4 | }
5 |
--------------------------------------------------------------------------------
/src/types/scss.d.ts:
--------------------------------------------------------------------------------
1 | declare module "*.scss" {
2 | const content: string;
3 | export default content;
4 | }
5 |
--------------------------------------------------------------------------------
/src/types/types.d.ts:
--------------------------------------------------------------------------------
1 | export {};
2 | declare global {
3 | interface FileInfo {
4 | path: string; // 文件路径
5 | isdir?: number; // 是否为目录
6 | errno?: number; // =0成功, !=0为失败
7 | size?: number; // 文件大小, 若为目录则=0
8 | md5?: string; // md5
9 | md5s?: string; // 前256KiB md5
10 | fs_id?: string; // 云端文件id
11 | retry_996?: boolean; // 用于判断是否使用备用生成接口
12 | }
13 | interface String {
14 | fromBase64: any;
15 | toBase64: any;
16 | }
17 | interface Element {
18 | __vue__: any;
19 | }
20 | interface HTMLElement {
21 | value: string;
22 | checked: boolean;
23 | }
24 | interface Window {
25 | require: any;
26 | locals: any;
27 | yunData: any;
28 | }
29 | // var __non_webpack_require__: any;
30 | }
31 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "outDir": "./dist/", // 打包到的目录
5 | "noImplicitAny": false,
6 | "noUnusedLocals": true,
7 | "noUnusedParameters": true,
8 | "module": "ES2015",
9 | "moduleResolution": "Node",
10 | "target": "es5", // 转化成的目标语言 设为es5以支持更多浏览器
11 | "baseUrl": ".",
12 | "paths": { "@/*": ["src/*"] },
13 | "types": ["node", "tampermonkey", "jquery"], // 引入的全局类型声明
14 | "typeRoots": ["./node_modules/@types"],
15 | "lib": ["dom", "es2015"],
16 | "jsx": "react",
17 | "allowJs": false,
18 | "allowSyntheticDefaultImports": true
19 | },
20 | "include": ["src/**/*.tsx", "src/**/*.ts"], // 要打包的文件
21 | "exclude": ["node_modules", "*.test.ts"]
22 | }
23 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2 | const WebpackUserscript = require("webpack-userscript");
3 | const TerserPlugin = require("terser-webpack-plugin");
4 | const path = require("path");
5 | // const nodeExternals = require("webpack-node-externals");
6 | const requireFunc =
7 | typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; // 忽略源码中的require功能
8 | module.exports = {
9 | mode: "production",
10 | entry: path.resolve(__dirname, "src", "app.tsx"),
11 | externalsPresets: { node: true },
12 | // externals: [nodeExternals()],
13 | resolve: {
14 | extensions: [".js", ".ts", ".tsx", ".json"],
15 | alias: {
16 | "@": path.resolve(__dirname, "src/"),
17 | },
18 | },
19 | output: {
20 | filename: "秒传连接提取.user.js",
21 | path: path.resolve(__dirname, "dist"),
22 | },
23 | module: {
24 | rules: [
25 | {
26 | test: /\.html$/,
27 | use: [
28 | {
29 | loader: "text-loader",
30 | },
31 | ],
32 | exclude: /node_modules/,
33 | },
34 | {
35 | test: /\.tsx?$/,
36 | use: [
37 | {
38 | loader: "ts-loader",
39 | options: {
40 | configFile: path.resolve(__dirname, "./tsconfig.json"),
41 | },
42 | },
43 | ],
44 | exclude: /node_modules/,
45 | },
46 | {
47 | test: /\.s[ac]ss$/i,
48 | use: [
49 | {
50 | loader: "text-loader",
51 | },
52 | "sass-loader",
53 | ],
54 | exclude: /node_modules/,
55 | },
56 | {
57 | test: /\.css$/,
58 | use: [
59 | {
60 | loader: "text-loader",
61 | },
62 | ],
63 | exclude: /node_modules/,
64 | },
65 | ],
66 | },
67 | plugins: [
68 | new MiniCssExtractPlugin(),
69 | // 生成userscript header信息
70 | new WebpackUserscript({
71 | headers: {
72 | name: "秒传链接提取",
73 | "name:en": `[name]`,
74 | version: `[version]`,
75 | author: `[author]`,
76 | license: `GPLv3`,
77 | icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABBUlEQVR4AZTTJRBUURTH4TtDwXuPdPrgbhHXiksf3CPucRNScHd3d3d3uO9bKeu7b79+fun8Q17CNHyMMUqaiPE4fEyYVjjGNKnNwQ4lpgV8lManEfwfosLHEGPU1N3ZnAv4qlT+NiQ56uPWSjKBrztUSnIaB66sY1vgxgxoMXB5NbsCB9rxcB5fN2M5/16nCFxeS6YTezpzsB1Pu/C2O7/78/99eYBYHXh+gqdHObGIK4GHgevjVIt1AgAnhvE4cGe8euoHbizgYuD2RGgx8O0RpwIPRmsmJDGqcrANd3pLo/qVr03hUlcpfSwf0/vD3JwkPdPK5/zhkOz+/f1FIDv/RcnOAEjywH/DhgADAAAAAElFTkSuQmCC",
78 | namespace: "moe.cangku.mengzonefire",
79 | supportURL: `https://github.com/mengzonefire/rapid-upload-userscript/issues`,
80 | homepageURL: `[homepage]`,
81 | contributionURL: "https://afdian.net/@mengzonefire",
82 | description: `[description]`,
83 | "description:en":
84 | "input bdlink to get files or get bdlink for Baidu™ WebDisk.",
85 | compatible: [
86 | "firefox Violentmonkey",
87 | "firefox Tampermonkey",
88 | "chrome Violentmonkey",
89 | "chrome Tampermonkey",
90 | "edge Violentmonkey",
91 | "edge Tampermonkey",
92 | ],
93 | match: [
94 | "*://pan.baidu.com/disk/home*",
95 | "*://pan.baidu.com/disk/main*",
96 | "*://pan.baidu.com/disk/synchronization*",
97 | "*://pan.baidu.com/s/*",
98 | "*://yun.baidu.com/disk/home*",
99 | "*://yun.baidu.com/disk/main*",
100 | "*://yun.baidu.com/disk/synchronization*",
101 | "*://yun.baidu.com/s/*",
102 | "*://wangpan.baidu.com/disk/home*",
103 | "*://wangpan.baidu.com/disk/main*",
104 | "*://wangpan.baidu.com/disk/synchronization*",
105 | "*://wangpan.baidu.com/s/*",
106 | ],
107 | grant: [
108 | "GM_setValue",
109 | "GM_getValue",
110 | "GM_deleteValue",
111 | "GM_setClipboard",
112 | "GM_addStyle",
113 | "GM_xmlhttpRequest",
114 | "GM_registerMenuCommand",
115 | "unsafeWindow",
116 | ],
117 | "run-at": "document-body",
118 | connect: ["baidu.com", "baidupcs.com", "cdn.jsdelivr.net", "*"],
119 | downloadURL:
120 | "https://greasyfork.org/scripts/424574/code/%E7%A7%92%E4%BC%A0%E9%93%BE%E6%8E%A5%E6%8F%90%E5%8F%96.user.js",
121 | updateURL:
122 | "https://greasyfork.org/scripts/424574/code/%E7%A7%92%E4%BC%A0%E9%93%BE%E6%8E%A5%E6%8F%90%E5%8F%96.user.js",
123 | antifeature:
124 | 'referral-link 23.4.5: 加了一个百度官方的网盘会员推广 (从那里开通可使作者获得佣金), 觉得碍眼可以点 "不再显示" 永久隐藏',
125 | },
126 | pretty: true,
127 | }),
128 | ],
129 | optimization: {
130 | minimize: false,
131 | // 完全禁用压缩(会导致下面的配置项全部失效), 防止在greasyfork上被举报为加密/最小化代码
132 | minimizer: [
133 | new TerserPlugin({
134 | parallel: true,
135 | extractComments: false,
136 | terserOptions: {
137 | // 以下四项为禁用代码压缩 + 不压缩标识符
138 | mangle: false,
139 | compress: false,
140 | keep_fnames: true,
141 | keep_classnames: true,
142 | format: {
143 | // 输出格式化, 防止在greasyfork上被举报为最小化代码
144 | beautify: true,
145 | // 删除注释
146 | comments: false,
147 | },
148 | },
149 | }),
150 | ],
151 | },
152 | };
153 |
--------------------------------------------------------------------------------