read local env URL endpoint from .env.local, and change text color to white for easier reading
This commit is contained in:
parent
c4ba2c8625
commit
fac45c616b
|
@ -2,10 +2,12 @@ import type {NextApiRequest, NextApiResponse} from "next";
|
||||||
|
|
||||||
type ConfigData = {
|
type ConfigData = {
|
||||||
apiBaseUrl: string
|
apiBaseUrl: string
|
||||||
|
verifierHost: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function handler(req: NextApiRequest, res: NextApiResponse<ConfigData>) {
|
export default function handler(req: NextApiRequest, res: NextApiResponse<ConfigData>) {
|
||||||
// Return the API_BASE_URL. This Endpoint allows us to access the env Variable in client javascript
|
// 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})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/pass.ts
12
src/pass.ts
|
@ -102,12 +102,10 @@ export class PassData {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('registering ' + JSON.stringify(clonedReceipt, null, 2));
|
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 = 'https://verifier.vaccine-ontario.ca';
|
||||||
// const verifierHost = (await configResponse.json()).verifierHost
|
|
||||||
|
|
||||||
const verifierHost = 'https://verifier.vaccine-ontario.ca';
|
|
||||||
// const verifierHost = 'http://localhost:5001/grassroot-verifier/us-central1';
|
|
||||||
|
|
||||||
const response = await fetch(`${verifierHost}/register`, requestOptions);
|
const response = await fetch(`${verifierHost}/register`, requestOptions);
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
|
@ -119,7 +117,7 @@ export class PassData {
|
||||||
|
|
||||||
// Create QR Code Object
|
// Create QR Code Object
|
||||||
const qrCode: QrCode = {
|
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,
|
format: QrFormat.PKBarcodeFormatQR,
|
||||||
messageEncoding: Encoding.iso88591,
|
messageEncoding: Encoding.iso88591,
|
||||||
// altText : payload.rawData
|
// altText : payload.rawData
|
||||||
|
@ -171,7 +169,7 @@ export class PassData {
|
||||||
// Sign hash with server
|
// Sign hash with server
|
||||||
const manifestSignature = await PassData.signWithRemote({
|
const manifestSignature = await PassData.signWithRemote({
|
||||||
PassJsonHash: passHash,
|
PassJsonHash: passHash,
|
||||||
useBlackVersion: true,
|
useBlackVersion: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add signature to zip
|
// Add signature to zip
|
||||||
|
|
|
@ -112,10 +112,10 @@ export class Payload {
|
||||||
this.backgroundColor = COLORS.YELLOW;
|
this.backgroundColor = COLORS.YELLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.labelColor = COLORS.BLACK
|
this.labelColor = COLORS.WHITE
|
||||||
this.foregroundColor = COLORS.BLACK
|
this.foregroundColor = COLORS.WHITE
|
||||||
this.img1x = Constants.img1xBlack
|
this.img1x = Constants.img1xWhite
|
||||||
this.img2x = Constants.img2xBlack
|
this.img2x = Constants.img2xWhite
|
||||||
this.generic = generic;
|
this.generic = generic;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue