Skip to content
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

Cannot claim new printer #15

Open
KTamas opened this issue May 10, 2020 · 14 comments
Open

Cannot claim new printer #15

KTamas opened this issue May 10, 2020 · 14 comments

Comments

@KTamas
Copy link

KTamas commented May 10, 2020

  1. go to https://little-printer-claim-code.netlify.app/
  2. copy the claim code
  3. go to http://littleprinter.nordprojects.co/
  4. enter the claim code, give it a name, press "Claim printer"
  5. You're redirected to the home page and the printer is not added; no error message is displayed.
@joerick
Copy link
Member

joerick commented May 10, 2020

Afraid I don't know how the little-printer-claim-code site works, but fake printers still work on the server-

joerick@joerick3 ~/P/sirius> heroku run bash                        130 master?
Running bash on ⬢ nord-sirius... up, run.6661 (Hobby)
~ $ ./manage.py fake printer
/app/sirius/emulate/commands.py:8: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util.ssl_ (/app/.heroku/python/lib/python3.7/site-packages/urllib3/util/ssl_.py)', 'urllib3.util (/app/.heroku/python/lib/python3.7/site-packages/urllib3/util/__init__.py)']. 
  gevent.monkey.patch_all()
[2020-05-10 11:13:11,045] DEBUG in webapp: Creating app.
DEBUG:sirius.web.webapp:Creating app.
     address: 18252e3bd7249cc2
       DB id: 323
      secret: a5d1bb83a9
         xor: 487148
  claim code: 234b-cnev-hfnh-fvqd

Created printer and saved as 18252e3bd7249cc2.printer

I've added this to the site and it's showing up as a new printer.

I did push some changes a couple of weeks back but it didn't change the claim logic - e5adbc4...nordprojects:master

@KTamas
Copy link
Author

KTamas commented May 10, 2020

@joerick well, it may be in the server but sure not on the UI, I tried two printers already and yet I only see my real fake printer
Screenshot 2020-05-10 13 20 18

@KTamas
Copy link
Author

KTamas commented May 10, 2020

(the source for the site: https://github.com/notjosh/little-printer-claim-code-web, @notjosh ported the printer generation logic to javascript)

@joerick
Copy link
Member

joerick commented May 10, 2020

(complete guess from reading the server code) try to have your fake printer connect to the server, then perform the claim

@KTamas
Copy link
Author

KTamas commented May 10, 2020

@joerick I tried, and this happens:

root@raspi4 ~/sirius-client# ts-node bin/client.ts
Contacting wss://littleprinter.nordprojects.co/api/v1/connection
     address: 0aaab8e735e378b4
      secret: 13382744232
  claim code: zmkh-67ed-g2nf-6y40
-----------------------------
connecting to wss://littleprinter.nordprojects.co/api/v1/connection as: bridge: 2922fc8781b58000, device: 0aaab8e735e378b4
upgrade
open
Asked for encryption key
Asked for encryption key
Asked for encryption key
Asked for encryption key
Asked for encryption key
Asked for encryption key
Asked for encryption key

And it does not show up in the UI.

@KTamas
Copy link
Author

KTamas commented May 10, 2020

@joerick tried claiming the printer again, still nothing.

@joerick
Copy link
Member

joerick commented May 10, 2020 via email

@KTamas
Copy link
Author

KTamas commented May 10, 2020

I'll try to create a new printer from sirius but I don't think @notjosh 's algo is in the wrong here.

@KTamas
Copy link
Author

KTamas commented May 10, 2020

@joerick I take it back, it is something with @notjosh 's code. I made a printer from sirius with manage.py and that works.

@KTamas
Copy link
Author

KTamas commented May 10, 2020

@joerick however, my local sirius instance gives me a 503 error.

@joerick
Copy link
Member

joerick commented May 17, 2020

did you manage to get anywhere further with this @KTamas ?

@notjosh
Copy link
Collaborator

notjosh commented May 17, 2020

Two things to add!

  1. I fixed https://little-printer-claim-code.netlify.app/, since this ticket was created, as it was using the address to make the claim code, not the xor. (Was a classic "tests from sirius are passing, this must work fine", doh 🤦). So the claim codes seem to work okay again now!
  2. 503s happen for a few reasons silently, but show details in the logs. We should probably surfaced that error up to the user somehow. I was losing my mind when I was trying to claim a printer that had been previously claimed by another user - "503" with no message :<

@joerick
Copy link
Member

joerick commented May 17, 2020

Ah great! Thanks for the update. Do the 503s represent unhandled exceptions in the Python server or something else?

@notjosh
Copy link
Collaborator

notjosh commented May 17, 2020

Yeah, exactly that.

For example, this snippet causes a response like:

Messages Image(2667305189)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants