Skip to content

Commit

Permalink
Merge pull request #14 from Code-Hex/fix/issues
Browse files Browse the repository at this point in the history
fixed some issues for cookie
  • Loading branch information
Code-Hex authored Feb 19, 2024
2 parents 26faba9 + 4260453 commit bf1f5be
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"deno.codeLens.references": true,
"deno.enablePaths": [
"./scripts"
],
"deno.enable": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"test": "vitest run",
"test-with-emulator": "firebase emulators:exec --project project12345 'vitest run'",
"build": "run-p build:*",
"build": "deno run --allow-read --allow-write scripts/version.ts && run-p build:*",
"build:main": "tsc -p tsconfig.main.json",
"build:module": "tsc -p tsconfig.module.json",
"start-firebase-emulator": "firebase emulators:start --project project12345",
Expand Down
16 changes: 16 additions & 0 deletions scripts/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const decoder = new TextDecoder('utf-8');
const encoder = new TextEncoder();

async function updateVersion() {
const packageJsonText = decoder.decode(await Deno.readFile('./package.json'));
const packageJson = JSON.parse(packageJsonText);
const version = packageJson.version;

const versionTsContent = `export const version = '${version}';\n`;
await Deno.writeFile('src/version.ts', encoder.encode(versionTsContent));
}

updateVersion().catch(error => {
console.error('failed to update version.ts:', error);
Deno.exit(1);
});
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { version } from '../package.json';
import type { ApiSettings } from './api-requests';
import type { Credential } from './credential';
import { useEmulator, type EmulatorEnv } from './emulator';
import { AppErrorCodes, FirebaseAppError } from './errors';
import { version } from './version';

/**
* Specifies how failing HTTP requests should be retried.
Expand Down
2 changes: 1 addition & 1 deletion src/jwk-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class UrlKeyFetcher implements KeyFetcher {

// store the public keys cache in the KV store.
const maxAge = parseMaxAge(cacheControlHeader);
if (!isNaN(maxAge)) {
if (!isNaN(maxAge) && maxAge > 0) {
await this.keyStorer.put(JSON.stringify(publicKeys.keys), maxAge);
}

Expand Down
1 change: 1 addition & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const version = '1.2.0';

0 comments on commit bf1f5be

Please sign in to comment.