-
Notifications
You must be signed in to change notification settings - Fork 77
添加Scbackend扩展 #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
添加Scbackend扩展 #318
Conversation
| "scbackendsdk.connect": "\u8FDE\u63A5\u5230 [remaddr] \u670D\u52A1\u5668\u4E0A\u7684 [instname] \u5B9E\u4F8B", | ||
| "scbackendsdk.connectwait": "\u8FDE\u63A5\u5230 [remaddr] \u670D\u52A1\u5668\u7684 [instname] \u5B9E\u4F8B \u5E76\u7B49\u5F85\u8FDE\u63A5\u5B8C\u6210", | ||
| "scbackendsdk.disconnect": "\u65AD\u5F00\u8FDE\u63A5", | ||
| "scbackendsdk.isconnected": "\u5DF2\u8FDE\u63A5\uFF1F", | ||
| "scbackendsdk.send": "\u53D1\u9001\u6D88\u606F [msg]", | ||
| "scbackendsdk.whenmessage": "\u5F53\u6536\u5230\u6D88\u606F", | ||
| "scbackendsdk.getmsg": "\u6536\u5230\u7684\u6D88\u606F" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议unicode编码,不太便于检查
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsup打包出来就是这样的,你加入编辑器里就可以正常显示了
| const translate = function(key) { | ||
| const locale = globalThis.navigator.language.slice(0, 2); | ||
| if (l10n_default[locale] && l10n_default[locale][key]) { | ||
| return l10n_default[locale][key]; | ||
| } else { | ||
| return l10n_default["en"][key] || key; | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有runtime.getFormatMessage不用?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这玩意我真不知道我去改改
| async connectwait(args, util) { | ||
| await new Promise((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接return这个promise呗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对吼
| blockMenu: { | ||
| acceptReporters: true, | ||
| items: [{ text: translate("scbackendsdk.connect.wait"), value: true }, { text: translate("scbackendsdk.connect.dontwait"), value: false }] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
啥玩意,都没用上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
忘了删了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你几乎无法在这个文件里找到任何一个驼峰命名的变量或属性
|
|
||
| // src/index.js | ||
| (function(Scratch2) { | ||
| if (Scratch2.extensions.unsandboxed === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议直接感叹号
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsup自动打包成这样的
| }, | ||
| { | ||
| blockType: Scratch2.BlockType.COMMAND, | ||
| opcode: "connectwait", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
驼峰命名法这么难吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得opcode不能大写字母
| if (reject) reject(event); | ||
| }; | ||
| this.ws.onerror = (error) => { | ||
| if (reject) reject(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议添加兜底的console error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯
|
与其说什么Scbackend,不如直接改成websocket扩展 还能更通用更实用一些。 |
某些人说WebSocket危险,上来给我打了个危险标签,我那还敢搞,Scbackend可控一点,至于WebSocket我可不敢得罪人了 |
不管是ws还是你这个都过不了审,因为官方扩展是不允许这种能从网络获取信息的扩展的。 |
?为啥啊,mmo不也从网络获取信息 |
第三方的后端第一不能保证服务的稳定性,第二是不能保证传输的内容一定是安全的,第三用户可以自由改后端 写个获取什么不是轻轻松松的事情 |
那,怎么办,现在社区里外挂大哥作妖就不管了吗 |
No description provided.