Skip to content

fixed some issues for cookie #14

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

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';