Skip to content

Commit

Permalink
Merge branch 'main' into release/v0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Oct 14, 2023
2 parents a96ab94 + dabe7f3 commit adc1af9
Show file tree
Hide file tree
Showing 17 changed files with 1,474 additions and 834 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ coverage
CHANGELOG.md

tailwind.config.js

.env
15 changes: 12 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ git commit -m "✨ add login feature"
ScriptCat
的文档在另外的仓库中:[scriptcat.org](https://docs.scriptcat.org),使用
[docusaurus](https://docusaurus.io/)进行撰写,这有一些
[Markdown](https://docusaurus.io/

zh-CN/docs/markdown-features)
[Markdown](https://docusaurus.io/zh-CN/docs/markdown-features)
特性可以帮助你。如果你需要在本地预览修改后的文档,可以使用以下命令安装文档依赖并启动
dev server:

Expand All @@ -74,6 +72,12 @@ npm install
npm start
```

### 帮助我们翻译

[Crowdin](https://crowdin.com/project/scriptcat) 是一个在线的多语言翻译平台。如果你想帮助我们翻译 ScriptCat 的文档,可以在 Crowdin 上找到 ScriptCat 的项目,然后开始翻译。

扩展的翻译文件在`src/locales`目录下。

## 参与开发

ScriptCat 使用 ESLint 来规范代码风格,使用 Jest
Expand Down Expand Up @@ -103,3 +107,8 @@ npm run pack
```

在打包前,请确保在`dist`目录下生成了`scriptcat.pem`文件。

# 注意问题

- 使用`yarn install`时可能会出现错误,最好使用`npm i`
- `npm run dev`之后需要把`dist/ext`目录里面内容在浏览器扩展里面导入加载,然后开始改代码保存即可,浏览器是实时更新的
8 changes: 8 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
project_id: "620320"
api_token_env: CROWDIN_PERSONAL_TOKEN
preserve_hierarchy: true

files:
# JSON 翻译文件
- source: /src/locales/zh-CN/**/*
translation: /src/locales/%locale%/**/%original_file_name%
40 changes: 1 addition & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build:no-split": "webpack --mode production --config ./webpack/webpack.no.split.ts",
"dev:linter": "webpack --mode development --config ./webpack/webpack.linter.dev.ts",
"pack": "node ./build/pack.js",
"changlog": "gitmoji-changelog"
"changlog": "gitmoji-changelog",
"crowdin": "crowdin"
},
"dependencies": {
"@arco-design/web-react": "^2.51.1",
Expand Down Expand Up @@ -101,7 +102,6 @@
"webpack": "^5.88.2",
"webpack-bundle-analyzer": "^4.9.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.9.0",
"yaml-loader": "^0.8.0"
"webpack-merge": "^5.9.0"
}
}
14 changes: 7 additions & 7 deletions pkg/cloudscript/cloudscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type ExportCookies = {
[key: string]: any;
domain?: string;
url?: string;
cookie: chrome.cookies.Cookie[];
cookies?: chrome.cookies.Cookie[];
};

export type ExportParams = {
Expand Down Expand Up @@ -44,9 +44,7 @@ export function parseExportCookie(
const result = [];
for (let i = 0; i < lines.length; i += 1) {
const line = lines[i];
const detail: ExportCookies = {
cookie: [],
};
const detail: ExportCookies = {};
if (line.trim()) {
line.split(";").forEach((param) => {
const s = param.split("=");
Expand All @@ -55,11 +53,13 @@ export function parseExportCookie(
}
detail[s[0].trim()] = s[1].trim();
});
if (!detail.url && !detail.domain) {
if (detail.url || detail.domain) {
result.push(
new Promise<ExportCookies>((resolve) => {
detail.cookies = getCookies(detail);
resolve(detail);
getCookies(detail).then((cookies) => {
detail.cookies = cookies;
resolve(detail);
});
})
);
}
Expand Down
Loading

0 comments on commit adc1af9

Please sign in to comment.