Skip to content

Commit eada4cf

Browse files
committed
feat: 支持从 GitHub App 分享安装文件
1 parent 59d9ecd commit eada4cf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

dist/Installer.js

+6
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ async function installByURL (url, options) {
144144
override: false,
145145
...options
146146
};
147+
148+
const blobRegxp = /^https:\/\/github\.com\/(.+)\/blob\/(.+\.js$)/;
149+
if (blobRegxp.test(url)) {
150+
url = url.replace(blobRegxp, 'https://raw.githubusercontent.com/$1/$2');
151+
}
152+
147153
const request = new Request(url);
148154
const text = await request.loadString()
149155
.catch(async (e) => {

src/Installer.js

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ async function installByURL (url, options) {
8484
override: false,
8585
...options
8686
}
87+
88+
const blobRegxp = /^https:\/\/github\.com\/(.+)\/blob\/(.+\.js$)/
89+
if (blobRegxp.test(url)) {
90+
url = url.replace(blobRegxp, 'https://raw.githubusercontent.com/$1/$2')
91+
}
92+
8793
const request = new Request(url)
8894
const text = await request.loadString()
8995
.catch(async (e) => {

0 commit comments

Comments
 (0)