以太坊登录插件

请告诉我们您为添加此插件所做的所有事情。
您是否按照本主题前面所述添加了 before_code
这是标准安装吗?

1 个赞

in app.yml
Added like - git clone https//GitHub—-.git

Selfhosted on Ubuntu 18 , and it is standard install with ./setup command

所以你没有这样做

1 个赞

@RGJ 请问如何在此处添加 before_code,并请分享带有 before_code 的帖子给我

不,抱歉,您可以使用 Ctrl+F 来搜索该主题,它会引导您找到答案。

3 个赞

@RGJ 指的是 github 中的指南 :slight_smile: GitHub - spruceid/discourse-siwe-auth: Discourse plugin for SIWE authentication

在 app.yml 文件中,您需要在 hooks 部分下方添加以下部分

2 个赞

谢谢 @RGJ@Tris20,我会尝试这个方法并向你们更新。

它确实有效,谢谢,不知道为什么我之前没看到 :slightly_smiling_face:

更新:安装完成,插件运行正常,现在正在测试使用 ETH 钱包登录。

4 个赞

我认为这是坏的,当你点击 /discourse-siwe/auth 页面上的“Sign with Ethereum”按钮时,没有弹出窗口(请求签名)。

下面是点击按钮时出现的控制台日志。

SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
    at Function.parse [as parseJSON] (<anonymous>)
    at n (ajax-error.js:29:1)
    at e.popupAjaxError (ajax-error.js:71:1)
    at y (rsvp.js:435:1)
    at v (rsvp.js:421:1)
    at f (rsvp.js:370:1)
    at m.invoke (queue.ts:203:14)
    at m.flush (queue.ts:98:13)
    at f.flush (deferred-action-queues.ts:75:19)
    at $._end (index.ts:616:32)
    at _boundAutorunEnd (index.ts:257:12)
TypeError: Cannot destructure property 'message' of '(intermediate value)' as it is undefined.
    at e.signMessage (web3modal.js:66:1)
    at async e.runSigningProcess (web3modal.js:82:1)
    at async e.initAuth (siwe-auth-index.js:38:1)

对我来说,它在两个测试中都运行正常,并且稳定通过,使用的是 Infura ID。
你是如何配置插件的?

嗯,我尝试了 Infura 密钥或公共 RPC,以及手动输入 Infura 的主网 RPC。我不确定这是否是问题所在。

是否可以编辑/样式化使用 eth 登录的弹出窗口?

我还可以添加其他以太坊兼容网络吗?

您能举一个“以太坊友好型网络”的例子吗?

我的意思是就像 BSC 一样

我的意思是“币安智能链”

新错误

是的,我添加了 before_code 钩子。错误从这里开始,当我注释掉 siwe-auth 插件时,错误就不会发生。

I, [2025-02-11T03:40:25.992538 #1]  INFO -- : 
I, [2025-02-11T03:40:25.993236 #1]  INFO -- : 
> cd /var/www/discourse &amp;&amp; su discourse -c 'bundle exec rake db:migrate'
rake aborted!
hooks:
  before_code:
    - exec:
        cmd:
          - gem install rubyzip
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-gamification
          - git clone https://github.com/discourse/discourse-chat-integration
          - git clone https://github.com/angusmcleod/discourse-events
          - git clone https://github.com/discourse/discourse-ai
          - git clone https://github.com/discourse/discourse-subscriptions
          - git clone https://github.com/discourse/discourse-translator
          - git clone https://github.com/discourse/discourse-signatures
          - git clone https://github.com/merefield/discourse-locations
          - git clone https://github.com/discourse/discourse-reactions
          - git clone https://github.com/melhosseiny/discourse-nft-avatar
          - git clone https://github.com/discourse/discourse-follow
          - git clone https://github.com/spruceid/discourse-siwe-auth

请看下面的错误

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse &amp;&amp; su discourse -c 'bundle exec rake db:migrate' failed with return #&lt;Process::Status: pid 778 exit 1&gt;
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=&gt;"$home", "tag"=&gt;"migrate", "hook"=&gt;"db_migrate", "cmd"=&gt;["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

@RGJ 请参阅以上内容,希望我们能尽快解决 ^

完整日志:

redacted@server:/var/discourse$ sudo ./launcher rebuild app
检测到x86_64架构

解决方案已在我们的 fork 中,位于 https://github.com/communiteq/discourse-siwe-auth,我们尚未向主线提交 PR,因为修复提交有些混乱,但它运行良好。

1 个赞