MCPcopy
hub / github.com/LetTTGACO/elog / init

Method init

packages/plugin-image/src/platform/github.ts:17–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 }
16
17 async init() {
18 if (!this.config.host) {
19 out.access('未指定加速域名,将使用默认域名:https://raw.githubusercontent.com')
20 } else if (this.config.host?.includes('cdn.jsdelivr.net')) {
21 // 如果指定了加速域名
22 this.config.host = 'https://cdn.jsdelivr.net'
23 }
24 // 判断是否开启拓展点
25 if (this.config.secretExt) {
26 // 如果开了就从拓展点读取
27 this.config = await getSecretExt(this.config)
28 } else {
29 // 如果没开拓展点,就从配置文件/环境变量中读取
30 this.config = {
31 ...this.config,
32 token: this.config.token || process.env.GITHUB_TOKEN!,
33 }
34 }
35 if (!this.config.token || !this.config.user || !this.config.repo) {
36 out.err('缺少Github 配置信息')
37 process.exit(-1)
38 }
39 // 处理prefixKey
40 this.config.prefixKey = formattedPrefix(this.config.prefixKey)
41 this.isInit = true
42 }
43
44 async _fetch(
45 fileName: string,

Callers 2

constructorMethod · 0.95
_fetchMethod · 0.95

Calls 2

getSecretExtFunction · 0.90
formattedPrefixFunction · 0.90

Tested by

no test coverage detected