Closed yqs112358 closed 1 week ago
INFO Validating config
ERROR Plugin load failed: hexo-url-submission
Error: EISDIR: illegal operation on a directory, read
INFO
yqs112358 大佬你改的这版本加载失败:
$ hexo version
INFO Validating config
ERROR Plugin load failed: hexo-url-submission
Error: EISDIR: illegal operation on a directory, read
INFO
=====================[ Hexo Theme - Solitude ]=====================
##### #### # ##### ###### # # ###### ######
# # # # # # # # # # #
##### # # # # # # # # # ######
# # # # # # # # # # #
###### #### ##### ##### # ### ###### ######
2.0.12
===================================================================
GitHub: https://github.com/everfu/hexo-theme-solitude
hexo: 7.3.0
hexo-cli: 4.3.2
os: win32 10.0.22631 undefined
node: 20.12.0
acorn: 8.11.3
ada: 2.7.6
ares: 1.27.0
base64: 0.5.2
brotli: 1.1.0
cjs_module_lexer: 1.2.2
cldr: 44.1
icu: 74.2
llhttp: 8.1.1
modules: 115
napi: 9
nghttp2: 1.60.0
nghttp3: 0.7.0
ngtcp2: 0.8.1
openssl: 3.0.13+quic
simdutf: 4.0.8
tz: 2024a
undici: 5.28.3
unicode: 15.1
uv: 1.46.0
uvwasi: 0.0.20
v8: 11.3.244.8-node.19
zlib: 1.3.0.1-motley-40e35a7
奇怪了,我代码里特定判定过fs.statSync(keyPath).isFile()
来着🤔
哥们是用key文件还是环境变量传递授权json的?能不能贴下相关配置看看 @828767
奇怪了,我代码里特定判定过
fs.statSync(keyPath).isFile()
来着🤔 哥们是用key文件还是环境变量传递授权json的?能不能贴下相关配置看看 @828767
用的原先的JSON文件,文档里没见要改的说明,请问用环境变量该怎么配?_config.yml里google:
值留空?
url_submission:
enable: true
count: 10 # Submit limit
urls_path: 'submit_url.txt' # URL list file path
sitemap: 'sitemap.xml' # Sitemap path(e.g. the url is like this https://abnerwei.com/baidusitemap.xml, you can fill in `baidusitemap.xml`)
type: 'latest' # latest or all( latest: modified pages; all: posts & pages)
channels: # included channels are `baidu`, `google`, `bing`, `shenma`
google: # https://cloud.tencent.com/developer/article/2387384
key: "google.json" # Google key path 与站点 _config.yml同级(e.g. `google_key.json` or `data/google_key.json`):GOOGLE_KEY
count: 10 # Optional
@828767 对,用环境变量的话 channels->google->key 这个配置写空字符串就行 然后环境变量里面直接放授权json文本
目前如果通过环境变量传递
GOOGLE_KEY
,并且将配置文件中url_submission
->google
->key
配置项置空时,这里 https://github.com/abnerwei/hexo-url-submission/blob/49c4ca12038d86ccf481b8124559824960be403a/src/google_deployer.ts#L28 的require
会抛出异常,导致永远输出Google key file not exist, cancel submission.
,后面的JSON.parse(process.env.GOOGLE_KEY || '{}')
不会被执行。 如图:使用
hexo-fs
代替require
读取google key,解决了此问题。 修复后: