-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #842 from Hi-Windom/v0.35
V0.35
- Loading branch information
Showing
25 changed files
with
585 additions
and
280 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,49 @@ | ||
// github 根路径的 README.adoc 文件 | ||
|
||
link:./docs/Sillot-android[汐洛安卓] | ||
| link:./docs/Sillot-Gibbet[汐洛绞架] | ||
| link:./docs/compatibility[兼容性] | ||
| link:./docs/document[文档] | ||
| link:./docs/roadmap[路线图] | ||
|
||
image::split.png[Split Image] | ||
|
||
image:https://img.shields.io/github/license/Hi-Windom/Sillot?style=flat&color=0080ff[license] | ||
image:https://img.shields.io/github/last-commit/Hi-Windom/Sillot?style=flat&logo=git&logoColor=white&color=0080ff[last-commit] | ||
image:https://img.shields.io/github/languages/top/Hi-Windom/Sillot?style=flat&color=0080ff[repo-top-language] | ||
image:https://img.shields.io/github/languages/count/Hi-Windom/Sillot?style=flat&color=0080ff[repo-language-count] | ||
|
||
image:https://app.codacy.com/project/badge/Grade/3106acfdbc5041118d800c5b4f2f935d[ | ||
codacy, | ||
link="https://app.codacy.com/gh/Hi-Windom/Sillot/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade" | ||
] | ||
image:https://www.codefactor.io/repository/github/hi-windom/sillot/badge[ | ||
codefactor, | ||
link="https://www.codefactor.io/repository/github/hi-windom/sillot" | ||
] | ||
image:https://codecov.io/gh/Hi-Windom/Sillot/branch/master/graph/badge.svg?token=C6PLVT0R2V[ | ||
codecov, | ||
link="https://codecov.io/gh/Hi-Windom/Sillot" | ||
] | ||
image:https://img.shields.io/github/downloads/Hi-Windom/Sillot/total.svg?style=flat-square&color=A26738&logo=github[ | ||
downloads, | ||
link="https://github.com/Hi-Windom/Sillot/releases" | ||
] | ||
image:https://img.shields.io/docker/pulls/soltus/sillot?color=99CCFF&label=pulls&logo=docker&logoColor=99CCFF[ | ||
docker-pulls, | ||
link="https://hub.docker.com/r/soltus/sillot" | ||
] | ||
image:https://hits.b3log.org/Hi-Windom/Sillot.svg[ | ||
Hits, | ||
link="https://github.com/Hi-Windom/Sillot" | ||
] | ||
|
||
// 注意当前设置 master 为默认分支 | ||
image:https://repobeats.axiom.co/api/embed/708cdf00c747155e49ff28c0c0024e17a28e5705.svg[ | ||
Insights, | ||
link="https://github.com/Hi-Windom/Sillot/pulse" | ||
] | ||
|
||
image::../app/stage/icon.png[Sillot Logo] | ||
|
||
image::https://capsule-render.vercel.app/api?type=waving&color=timeGradient&height=300&§ion=footer&text=Hi-Windom&fontSize=90&fontAlign=50&fontAlignY=70&desc=Power%20by%20&descAlign=50&descSize=30&descAlignY=40&animation=twinkling[Hi-Windom Footer] |
This file was deleted.
Oops, something went wrong.
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
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,63 @@ | ||
import { Uri, type Webview } from "vscode"; | ||
import * as vscode from "vscode"; | ||
import * as path from "path"; | ||
import fs from "fs-extra"; | ||
|
||
/** | ||
* A helper function which will get the webview URI of a given file or resource. | ||
* | ||
* @remarks This URI can be used within a webview's HTML as a link to the | ||
* given file/resource. | ||
* | ||
* @param webview A reference to the extension webview | ||
* @param extensionUri The URI of the directory containing the extension | ||
* @param pathList An array of strings representing the path to a file/resource | ||
* @returns A URI pointing to the file/resource | ||
*/ | ||
export function getUri(webview: Webview, extensionUri: Uri, pathList: string[]) { | ||
return webview.asWebviewUri(Uri.joinPath(extensionUri, ...pathList)); | ||
} | ||
|
||
/** | ||
* A helper function that returns a unique alphanumeric identifier called a nonce. | ||
* | ||
* @remarks This function is primarily used to help enforce content security | ||
* policies for resources/scripts being executed in a webview context. | ||
* | ||
* @returns A nonce | ||
*/ | ||
export function getNonce() { | ||
let text = ""; | ||
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
for (let i = 0; i < 32; i++) { | ||
text += possible.charAt(Math.floor(Math.random() * possible.length)); | ||
} | ||
return text; | ||
} | ||
|
||
/** | ||
* 获取某个扩展文件相对于webview需要的一种特殊路径格式 | ||
* 形如:vscode-resource:/Users/toonces/projects/vscode-cat-coding/media/cat.gif | ||
* @param context 上下文 | ||
* @param relativePath 扩展中某个文件相对于根目录的路径,如 images/test.jpg | ||
*/ | ||
export function getExtensionFileVscodeResource(context: vscode.ExtensionContext, relativePath: string) { | ||
const diskPath = vscode.Uri.file(path.join(context.extensionPath, relativePath)); | ||
return diskPath.with({ scheme: "vscode-resource" }).toString(); | ||
} | ||
|
||
/** | ||
* 从某个HTML文件读取能被Webview加载的HTML内容 | ||
* @param {*} context 上下文 | ||
* @param {*} templatePath 相对于插件根目录的html文件相对路径 | ||
*/ | ||
export function getWebViewContent(context: vscode.ExtensionContext, templatePath: string) { | ||
const resourcePath = path.join(context.extensionPath, templatePath); | ||
const dirPath = path.dirname(resourcePath); | ||
let html = fs.readFileSync(resourcePath, "utf-8"); | ||
// vscode不支持直接加载本地资源,需要替换成其专有路径格式,这里只是简单的将样式和JS的路径替换 | ||
html = html.replace(/(<link.+?href="|<script.+?src="|<img.+?src=")(.+?)"/g, (m: any, $1: string, $2: string) => { | ||
return $1 + vscode.Uri.file(path.resolve(dirPath, $2)).with({ scheme: "vscode-resource" }).toString() + '"'; | ||
}); | ||
return html; | ||
} |
Oops, something went wrong.