Greasy Fork is available in English.

Discussioni » Sviluppo

An error is reported when quoting an external minimized script. 引用来自外部的最小化脚本时报错

Ziu
§
Pubblicato: 30/08/2021

I quoted a script from Github in the script I wrote:

//@include https://cdn.jsdelivr.net/gh/nwcell/ics.js@0.2.0/demo/ics.deps.min.js

But when I updated my script code, Greasy Fork prompted me not to reference this external script

Refer to the official help documentation:

https://greasyfork.org/zh-CN/help/external-scripts

And suggestions from the script manager:

Minified code isn't allowed inside scripts on GreasyFork even if you share the source code elsewhere. You can use a minified library in @require or @resource from a CDN https://greasyfork.org/help/external-scripts or load from a github repository using a link like https://cdn.jsdelivr.net/gh/AUTHOR/REPOSITORY@COMMITHASH/file-path.js. You can configure webpack to use externals automatically. If your script is big you can split it into libraries and upload them on GreasyFork (or github if use the CDN link shown above).

I also created this minimized script as a "library" type in greasyfork and referenced it, but it still failed the minimized check.

I don't know how to solve the problem of importing minimized scripts from outside.


我在编写的脚本中引用了来自Github的脚本:

//@include https://cdn.jsdelivr.net/gh/nwcell/ics.js@0.2.0/demo/ics.deps.min.js

但是当我更新我的脚本代码时,Greasy Fork提示我不允许引用这个外部脚本

参照官方帮助文档:

https://greasyfork.org/zh-CN/help/external-scripts

以及来自脚本管理员的建议:

即使您在其他地方共享源代码,GreasyFork 上的脚本中也不允许使用压缩代码。您可以使用来自 CDN https://greasyfork.org/help/external-scripts@require 或 @resource 中的缩小库,或使用 https://cdn.jsdelivr.net/gh/ 之类的链接从 github 存储库加载作者/存储库@COMMITHASH/file-path.js。您可以将 webpack 配置为自动使用 externals。如果您的脚本很大,您可以将其拆分为库并将它们上传到 GreasyFork(或 github,如果使用上面显示的 CDN 链接)。

我还将此经过最小化的脚本作为“库”类型创建在greasyfork中并引用,但还是没有通过最小化的检查。

我不知道该如何解决从外部引入经过最小化的脚本

wOxxOmMod
§
Pubblicato: 30/08/2021

Note the COMMITHASH and "jsDelivr GitHub commit-specific references" in the documentation. It means you need to use a full commit hash, not a version tag. This is because on github it's allowed to switch the version tag to a different commit at any time so there's no guarantee that the library won't be covertly switched to some backdoor or malware afterwards. When an explicit commit hash is used, the change will be detectable.

Replace https://cdn.jsdelivr.net/gh/nwcell/ics.js@0.2.0/demo/ics.deps.min.js
with https://cdn.jsdelivr.net/gh/nwcell/ics.js@dfec67f37a3c267b3f97dd229c9b6a3521222794/demo/ics.deps.min.js

The full commit hash is displayed in the address bar after you press y key when viewing the file on https://github.com/nwcell/ics.js/blob/master/demo/ics.deps.min.js page. It's also present in the link after Latest commit.

Ziu
§
Pubblicato: 30/08/2021

Note the COMMITHASH and "jsDelivr GitHub commit-specific references" in the documentation. It means you need to use a full commit hash, not a version tag. This is because on github it's allowed to switch the version tag to a different commit at any time so there's no guarantee that the library won't be covertly switched to some backdoor or malware afterwards. When an explicit commit hash is used, the change will be detectable.

Replace https://cdn.jsdelivr.net/gh/nwcell/ics.js@0.2.0/demo/ics.deps.min.js
with https://cdn.jsdelivr.net/gh/nwcell/ics.js@dfec67f37a3c267b3f97dd229c9b6a3521222794/demo/ics.deps.min.js

The full commit hash is displayed in the address bar after you press y key when viewing the file on https://github.com/nwcell/ics.js/blob/master/demo/ics.deps.min.js page. It's also present in the link after Latest commit.

Thanks for your help, I have successfully modified and uploaded my script, thank you again!

感谢您的帮助,我已经成功修改并上传了我的脚本,再次感谢您!

Pubblica risposta

Accedi per pubblicare una risposta.