-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 修复GM_xhr unsafeHeader 发送错误、popup支持运行
- Loading branch information
Showing
21 changed files
with
377 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// ==UserScript== | ||
// @name cloudscript | ||
// @namespace https://bbs.tampermonkey.net.cn/ | ||
// @version 0.1.0 | ||
// @description 可以导出成nodejs可执行的包,在云端执行 | ||
// @author You | ||
// @crontab * * once * * | ||
// @cloudCat | ||
// @exportCookie domain=.scriptscat.org | ||
// ==/UserScript== | ||
|
||
return new Promise((resolve, reject) => { | ||
// Your code here... | ||
resolve(); | ||
}); | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 脚本上云 | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export interface CloudScriptParams { | ||
[key: string]: { | ||
title: string; | ||
type?: "select"; | ||
options?: string[]; | ||
}; | ||
} | ||
|
||
export default class CloudScriptFactory { | ||
static create() {} | ||
|
||
static params(): { [key: string]: CloudScriptParams } { | ||
return { | ||
local: {}, | ||
}; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 文件系统 | ||
|
||
用于同步和备份至云端 | ||
|
||
- zip | ||
- webdav |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { DAO, db } from "./dao"; | ||
|
||
export type ExportTarget = "local" | "tencentCloud" | ""; | ||
|
||
// 导出与本地脚本关联记录 | ||
export interface Export { | ||
id: number; | ||
scriptId: number; | ||
params?: { | ||
[key: string]: { | ||
[key: string]: any; | ||
}; | ||
}; | ||
// 导出目标 | ||
target: ExportTarget; | ||
} | ||
|
||
export class ExportDAO extends DAO<Export> { | ||
public tableName = "export"; | ||
|
||
constructor() { | ||
super(); | ||
this.table = db.table(this.tableName); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { Script } from "@App/app/repo/scripts"; | ||
import { | ||
Button, | ||
Checkbox, | ||
Form, | ||
Input, | ||
Modal, | ||
Select, | ||
} from "@arco-design/web-react"; | ||
import FormItem from "@arco-design/web-react/es/Form/form-item"; | ||
import { IconQuestionCircleFill } from "@arco-design/web-react/icon"; | ||
import CloudScriptFactory from "@Pkg/cloudscript/factory"; | ||
import React, { useEffect } from "react"; | ||
|
||
const cloudScriptParams = CloudScriptFactory.params(); | ||
|
||
const CloudScriptList = [ | ||
{ | ||
key: "local", | ||
name: "本地", | ||
}, | ||
]; | ||
|
||
const CloudScript: React.FC<{ | ||
// eslint-disable-next-line react/require-default-props | ||
script?: Script; | ||
onClose: () => void; | ||
}> = ({ script, onClose }) => { | ||
const [visible, setVisible] = React.useState(false); | ||
const [cloudScriptType, setCloudScriptType] = React.useState("local"); | ||
|
||
useEffect(() => { | ||
if (script) { | ||
setVisible(true); | ||
} | ||
}, [script]); | ||
return ( | ||
<Modal | ||
title={ | ||
<div> | ||
<span | ||
style={{ | ||
height: "32px", | ||
lineHeight: "32px", | ||
}} | ||
> | ||
{script?.name} 上传至云 | ||
</span> | ||
<Button | ||
type="text" | ||
icon={ | ||
<IconQuestionCircleFill | ||
style={{ | ||
margin: 0, | ||
}} | ||
/> | ||
} | ||
href="https://docs.scriptcat.org/docs/dev/cloudcat/" | ||
target="_blank" | ||
iconOnly | ||
/> | ||
</div> | ||
} | ||
visible={visible} | ||
onCancel={() => { | ||
setVisible(false); | ||
onClose(); | ||
}} | ||
> | ||
<Form | ||
autoComplete="off" | ||
style={{ | ||
width: "100%", | ||
}} | ||
layout="vertical" | ||
> | ||
<FormItem label="上传至"> | ||
<Select | ||
value={cloudScriptType} | ||
onChange={(value) => { | ||
setCloudScriptType(value); | ||
}} | ||
> | ||
{CloudScriptList.map((item) => ( | ||
<Select.Option key={item.key} value={item.key}> | ||
{item.name} | ||
</Select.Option> | ||
))} | ||
</Select> | ||
</FormItem> | ||
{Object.keys(cloudScriptParams[cloudScriptType]).map((key) => { | ||
const item = cloudScriptParams[cloudScriptType][key]; | ||
return ( | ||
<FormItem key={key} label={item.title}> | ||
<Input /> | ||
</FormItem> | ||
); | ||
})} | ||
<FormItem label="值导出表达式"> | ||
<Input.TextArea /> | ||
</FormItem> | ||
<FormItem label=""> | ||
<Checkbox>导入时覆盖原值</Checkbox> | ||
</FormItem> | ||
<FormItem label="cookie导出表达式"> | ||
<Input.TextArea /> | ||
</FormItem> | ||
<FormItem label=""> | ||
<Checkbox>导入时覆盖原值</Checkbox> | ||
</FormItem> | ||
<Button type="primary">恢复默认值</Button> | ||
</Form> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default CloudScript; |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.