Skip to content

Commit

Permalink
修复老脚本没selfMetadata报错的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Oct 5, 2021
1 parent 22f9c1b commit 7336db7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/scriptcat/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "ScriptCat",
"version": "0.6.0",
"version": "0.6.1",
"description": "脚本猫,一个用户脚本的框架,可编写脚本每天帮你自动处理事务.",
"background": {
"page": "background.html"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scriptcat",
"version": "0.6.0",
"version": "0.6.1",
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
"scripts": {
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion src/apps/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const ExtVersion = "0.6.0";
export const ExtVersion = "0.6.1";

export const Server = process.env.NODE_ENV == "production" ? "https://sc.icodef.com/" : "http://localhost:8080/";
2 changes: 1 addition & 1 deletion src/apps/script/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class ScriptController {

// 自定义配置
for (const key in ret.metadata) {
if (ret.selfMetadata[key]) {
if (ret.selfMetadata && ret.selfMetadata[key]) {
ret.metadata[key] = ret.selfMetadata[key];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/script/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ export class ScriptManager {
script.runStatus = (<Script>old).runStatus;
}
script.sort = sync.sort;
script.selfMetadata = JSON.parse(sync.self_meta);
script.selfMetadata = JSON.parse(sync.self_meta) || {};
script.createtime = sync.createtime;
script.updatetime = sync.updatetime;
script.subscribeUrl = sync.subscribe_url
Expand Down
2 changes: 1 addition & 1 deletion src/apps/script/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function copyScript(script: Script, old: Script) {
script.delayruntime = old.delayruntime;
script.error = old.error;
script.sort = old.sort;
script.selfMetadata = old.selfMetadata;
script.selfMetadata = old.selfMetadata || {};
for (let key in script.selfMetadata) {
script.metadata[key] = script.metadata[key];
}
Expand Down
7 changes: 7 additions & 0 deletions src/views/components/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</v-avatar>
<h3 style="margin-top: 10px">{{ user.username }}</h3>
<div v-if="user.islogin">
<v-divider class="my-3"></v-divider>
<v-btn depressed rounded text @click="userInfo">个人设置</v-btn>
<v-divider class="my-3"></v-divider>
<v-btn depressed rounded text @click="logout">注销</v-btn>
</div>
Expand Down Expand Up @@ -67,5 +69,10 @@ export default class Snackbar extends Vue {
logout() {
userModule.logout();
}
userInfo() {
window.open(Server + "account/settings");
}
}
</script>

0 comments on commit 7336db7

Please sign in to comment.