From fac45c616b1ab5b8f752fe5d82eaad3a5d2c275d Mon Sep 17 00:00:00 2001 From: Billy Lo Date: Wed, 1 Sep 2021 06:32:18 -0400 Subject: [PATCH] read local env URL endpoint from .env.local, and change text color to white for easier reading --- pages/api/config.tsx | 4 +++- src/pass.ts | 12 +++++------- src/payload.ts | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pages/api/config.tsx b/pages/api/config.tsx index 781ca38..c2cf4f8 100644 --- a/pages/api/config.tsx +++ b/pages/api/config.tsx @@ -2,10 +2,12 @@ import type {NextApiRequest, NextApiResponse} from "next"; type ConfigData = { apiBaseUrl: string + verifierHost: string } export default function handler(req: NextApiRequest, res: NextApiResponse) { // Return the API_BASE_URL. This Endpoint allows us to access the env Variable in client javascript - res.status(200).json({apiBaseUrl: process.env.API_BASE_URL}) + + res.status(200).json({apiBaseUrl: process.env.API_BASE_URL, verifierHost: process.env.VERIFIER_HOST}) } diff --git a/src/pass.ts b/src/pass.ts index f805400..5f80415 100644 --- a/src/pass.ts +++ b/src/pass.ts @@ -102,12 +102,10 @@ export class PassData { } console.log('registering ' + JSON.stringify(clonedReceipt, null, 2)); + const configResponse = await fetch('/api/config') + const verifierHost = (await configResponse.json()).verifierHost - // const configResponse = await fetch('/api/config') - // const verifierHost = (await configResponse.json()).verifierHost - - const verifierHost = 'https://verifier.vaccine-ontario.ca'; - // const verifierHost = 'http://localhost:5001/grassroot-verifier/us-central1'; + // const verifierHost = 'https://verifier.vaccine-ontario.ca'; const response = await fetch(`${verifierHost}/register`, requestOptions); const responseJson = await response.json(); @@ -119,7 +117,7 @@ export class PassData { // Create QR Code Object const qrCode: QrCode = { - message: `https://verifier.vaccine-ontario.ca/verify?serialNumber=${payload.serialNumber}&vaccineName=${payload.receipt.vaccineName}&vaccinationDate=${payload.receipt.vaccinationDate}&organization=${payload.receipt.organization}&dose=${payload.receipt.numDoses}`, + message: `${verifierHost}/verify?serialNumber=${payload.serialNumber}&vaccineName=${payload.receipt.vaccineName}&vaccinationDate=${payload.receipt.vaccinationDate}&organization=${payload.receipt.organization}&dose=${payload.receipt.numDoses}`, format: QrFormat.PKBarcodeFormatQR, messageEncoding: Encoding.iso88591, // altText : payload.rawData @@ -171,7 +169,7 @@ export class PassData { // Sign hash with server const manifestSignature = await PassData.signWithRemote({ PassJsonHash: passHash, - useBlackVersion: true, + useBlackVersion: false, }); // Add signature to zip diff --git a/src/payload.ts b/src/payload.ts index 4660d13..9fd89c6 100644 --- a/src/payload.ts +++ b/src/payload.ts @@ -112,10 +112,10 @@ export class Payload { this.backgroundColor = COLORS.YELLOW; } - this.labelColor = COLORS.BLACK - this.foregroundColor = COLORS.BLACK - this.img1x = Constants.img1xBlack - this.img2x = Constants.img2xBlack + this.labelColor = COLORS.WHITE + this.foregroundColor = COLORS.WHITE + this.img1x = Constants.img1xWhite + this.img2x = Constants.img2xWhite this.generic = generic; }