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

Server side QR code rendering #122

Merged
merged 24 commits into from
Jun 5, 2020
Merged

Server side QR code rendering #122

merged 24 commits into from
Jun 5, 2020

Conversation

kylerwsm
Copy link
Contributor

@kylerwsm kylerwsm commented May 27, 2020

Problem

Solution

I am using jsdom as an alternative dom for node, and d3 to draw our GoGovSg logo on the generated QR code generated from the qrcode library.

TODO

  • Generate SVG QR code
  • Generate PNG QR code
  • Generate JPEG QR code
  • Write test for QR code
  • Add validation using Joi
  • Add short url into QR code
  • QR codes can only be generated if user is signed in
  • Only QR codes of existing links can be generated

After

image

Tests

  • Download QR code on modern browsers locally
  • Download QR code on IE11 locally
  • Download QR code on modern browsers on staging
  • Download QR code on IE11 on staging

Deploy Notes

New dependencies:

  • d3 : To add our Go QR code to the generated QR code.
  • jsdom : To render our QR code in a node environment.
  • sharp: A convenient tool to convert our source svg QR code to png and jpeg formats.

New dev dependencies:

  • jsqr: To read rendered QR code for testing.
  • upng-js: To parse rendered .png QR codes for testing.

@kylerwsm kylerwsm requested review from liangyuanruo and yong-jie May 28, 2020 06:13
@kylerwsm kylerwsm marked this pull request as ready for review May 28, 2020 06:13
@kylerwsm kylerwsm changed the base branch from develop to release-1.16.1 May 29, 2020 17:55
Copy link
Member

@yong-jie yong-jie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping a review with some comments and questions. Also just to check: is the QR code generation now purely a backend task? What plans do we have to incorporate #113, which allows for shortlinks under the qr code?

src/server/api/qrcode.ts Outdated Show resolved Hide resolved
src/server/api/qrcode.ts Outdated Show resolved Hide resolved
Base automatically changed from release-1.16.1 to develop June 1, 2020 06:06
@kylerwsm kylerwsm requested a review from yong-jie June 1, 2020 13:13
Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes requested as commented.

@kylerwsm kylerwsm requested review from liangyuanruo and yong-jie June 2, 2020 08:12
@yong-jie yong-jie mentioned this pull request Jun 2, 2020
@liangyuanruo liangyuanruo merged commit afba70b into develop Jun 5, 2020
@liangyuanruo liangyuanruo deleted the qr-code branch June 5, 2020 08:29
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

Successfully merging this pull request may close these issues.

Problem with PNG downloads on IE11 Bundle QR code with link in same image
3 participants