Skip to content

Commit

Permalink
v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iCharlesZ committed Nov 29, 2021
1 parent 2ba94c2 commit c51f3f0
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

### 1.8.0 | 2021-11-29

- 修复新版本 VSCode 不能正常显示的问题

### 1.7.0 | 2020-11-19

- 增加英文版本
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ A: see here: https://github.com/lehni/vscode-fix-checksums

## Release Notes 版本说明

### 1.8.0 | 2021-11-29

- 修复新版本 VSCode 不能正常显示的问题

### 1.7.0 | 2020-11-19

- 增加英文版本
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-live2d",
"displayName": "vscode-live2d",
"description": "vscode看板娘",
"version": "1.7.2",
"version": "1.8.0",
"publisher": "CharlesZ",
"engines": {
"vscode": "^1.47.0"
Expand Down
14 changes: 14 additions & 0 deletions src/Dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import * as fs from 'fs';
import FileType from './FileType';
import vsHelp from './vsHelp';
import getNewContent from './getJs';
import getNewHTML from './allowScript';
import getOriginalHtml from './originalHtml';

export class Dom {
//当前用户配置
Expand Down Expand Up @@ -88,6 +90,12 @@ export class Dom {
newContent += content;

this.saveContent(newContent);

// 设置新的HTML
let newHTML = getNewHTML().replace(/\s*$/, '');
const htmlPath = path.join(path.dirname(require.main.filename), 'vs', 'code', 'electron-browser', 'workbench', 'workbench.html');
fs.writeFileSync(htmlPath, newHTML, 'utf-8');

vsHelp.showInfoRestart(this.extName + ' 已更新配置,请重新启动!');

}
Expand Down Expand Up @@ -135,6 +143,12 @@ export class Dom {
let content = this.getContent();
content = this.clearJSContent(content);
this.saveContent(content);

// 还原HTML
let originalHtml = getOriginalHtml().replace(/\s*$/, '');
const htmlPath = path.join(path.dirname(require.main.filename), 'vs', 'code', 'electron-browser', 'workbench', 'workbench.html');
fs.writeFileSync(htmlPath, originalHtml, 'utf-8');

return true;
}
catch (ex) {
Expand Down
32 changes: 13 additions & 19 deletions src/allowScript.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
export default function () {
return `<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview: https://*.vscode-webview-test.com; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote-resource:;"/>
</head>
<body aria-label="">
</body>
<!-- Init Bootstrap Helpers -->
<script src="../../../../bootstrap.js"></script>
<script src="../../../../vs/loader.js"></script>
<script src="../../../../bootstrap-window.js"></script>
<!-- Startup via workbench.js -->
<script src="workbench.js"></script>
</html>
`;
return `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview: https://*.vscode-webview-test.com; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote-resource:;"/>
</head>
<body aria-label="">
</body>
<script src="../../../../bootstrap.js"></script>
<script src="../../../../vs/loader.js"></script>
<script src="../../../../bootstrap-window.js"></script>
<script src="workbench.js"></script>
</html>`;
}
7 changes: 7 additions & 0 deletions src/uninstall.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from 'path';
import * as fs from 'fs';
import getOriginalHtml from './originalHtml';

const base = process.cwd();
// 文件路径
Expand All @@ -19,6 +20,12 @@ function main() {
saveContent(content);
removeFiles(path.join(base, 'vs', 'code', 'electron-browser', 'workbench', 'live2d'));
removeFiles(path.join(base, 'vs', 'code', 'electron-browser', 'workbench', 'models'));

// 还原HTML
let originalHtml = getOriginalHtml().replace(/\s*$/, '');
const htmlPath = path.join(path.dirname(require.main.filename), 'vs', 'code', 'electron-browser', 'workbench', 'workbench.html');
fs.writeFileSync(htmlPath, originalHtml, 'utf-8');

return true;
}
catch (ex) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '1.7.2';
export default '1.8.0';

0 comments on commit c51f3f0

Please sign in to comment.