added expiration date and default to ON logic

This commit is contained in:
Billy Lo 2021-10-03 21:51:49 -04:00
parent 8eac24880d
commit bbb81c6920
8 changed files with 2697 additions and 2611 deletions

View File

@ -36,7 +36,7 @@ function Page(props: PageProps): JSX.Element {
<a href="https://github.com/billylo1/covidpass" className="underline">{t('common:gitHub')}</a>
<a href="https://vaccine-ontario.ca" className="underline">{t('common:returnToMainSite')}</a>
</nav>
<div className="flex pt-4 flex-row space-x-4 justify-center text-md flex-wrap">Last updated: 2021-10-01 (v1.9.13)</div>
<div className="flex pt-4 flex-row space-x-4 justify-center text-md flex-wrap">Last updated: 2021-10-03 (v1.9.14)</div>
</footer>
</main>
</div>

23
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "grassroots_covidpass",
"version": "1.8.0",
"version": "1.9.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "grassroots_covidpass",
"version": "1.8.0",
"version": "1.9.7",
"license": "MIT",
"dependencies": {
"@headlessui/react": "^1.3.0",
@ -49,6 +49,7 @@
},
"devDependencies": {
"@types/pako": "^1.0.1",
"@types/pngjs": "^6.0.1",
"@types/react": "^17.0.11",
"autoprefixer": "^10.0.4",
"postcss": "^8.1.10",
@ -499,6 +500,15 @@
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
"dev": true
},
"node_modules/@types/pngjs": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz",
"integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/prop-types": {
"version": "15.7.3",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
@ -5700,6 +5710,15 @@
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
"dev": true
},
"@types/pngjs": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.1.tgz",
"integrity": "sha512-J39njbdW1U/6YyVXvC9+1iflZghP8jgRf2ndYghdJb5xL49LYDB+1EuAxfbuJ2IBbWIL3AjHPQhgaTxT3YaYeg==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/prop-types": {
"version": "15.7.3",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",

View File

@ -74,13 +74,12 @@ function Index(): JSX.Element {
<Card content={
<div><p>{t('common:subtitle')}</p><br /><p>{t('common:subtitle2')}</p><br />
<b>{displayPassCount}</b><br/><br/>
Oct 1 morning update:
Oct 3 evening update:
<br />
<br />
<ul className="list-decimal list-outside" style={{ marginLeft: '20px' }}>
<li>Foundation improvements</li>
<li>You can now select which page to import for multi-page receipts</li>
<li>System reminders (e.g. unsupported browsers) are now on the top to improve ease of use</li>
<li>Added expiration date so it aligns with the province's schedule.</li>
<li>On Oct 22, we will update this tool as well so you can import the official QR code into your mobile wallet too.</li>
</ul><br />
<p>{t('common:continueSpirit')}</p>
<br />

View File

@ -30,6 +30,7 @@ export class PassData {
barcodes: Array<QrCode>;
barcode: QrCode;
generic: PassDictionary;
expirationDate: string;
// Generates a sha1 hash from a given buffer
private static getBufferHash(buffer: Buffer | string): string {
@ -139,5 +140,6 @@ export class PassData {
this.barcode = qrCode;
this.generic = payload.generic;
this.sharingProhibited = true;
this.expirationDate = payload.expirationDate;
}
}

View File

@ -46,6 +46,7 @@ export class Payload {
img2x: Buffer;
serialNumber: string;
generic: PassDictionary;
expirationDate: string;
constructor(body: PayloadBody, numDose: number) {
@ -82,7 +83,7 @@ export class Payload {
this.receipts = body.receipts;
this.rawData = body.rawData;
this.generic = generic;
this.expirationDate = '2021-10-22T23:59:59-04:00';
}
}

View File

@ -59,16 +59,21 @@ async function detectReceiptType(fileBuffer : ArrayBuffer): Promise<string> {
const pdfPage = await pdfDocument.getPage(1); //first page
const content = await pdfPage.getTextContent();
const numItems = content.items.length;
for (let i = 0; i < numItems; i++) {
let item = content.items[i] as TextItem;
const value = item.str;
console.log(value);
if (value.includes('COVID-19 vaccination receipt')) {
console.log('detected on');
return Promise.resolve('ON');
if (numItems == 0) { // QC has no text items
console.log('detected QC');
return Promise.resolve('SHC');
} else {
for (let i = 0; i < numItems; i++) {
let item = content.items[i] as TextItem;
const value = item.str;
// console.log(value);
if (value.includes('BC Vaccine Card')) {
console.log('detected BC');
return Promise.resolve('SHC');
}
}
}
return Promise.resolve('SHC');
return Promise.resolve('ON');
}

View File

@ -3,7 +3,7 @@ import { Integrations } from '@sentry/tracing';
export const initSentry = () => {
SentryModule.init({
release: 'grassroots_covidpass@1.9.12', // App version. Needs to be manually updated as we go unless we make the build smarter
release: 'grassroots_covidpass@1.9.14', // App version. Needs to be manually updated as we go unless we make the build smarter
dsn: 'https://7120dcf8548c4c5cb148cdde2ed6a778@o1015766.ingest.sentry.io/5981424',
integrations: [
new Integrations.BrowserTracing(),

5248
yarn.lock

File diff suppressed because it is too large Load Diff