-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(page): use qualified url for service worker
- Loading branch information
1 parent
3803877
commit c5f760d
Showing
6 changed files
with
17 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
import { hash } from 'object-code'; | ||
|
||
export const etag = async (input: any): Promise<string> => { | ||
const entity = JSON.stringify(input); | ||
|
||
const textAsBuffer = new TextEncoder().encode(entity); | ||
const hashBuffer = await crypto.subtle.digest("SHA-1", textAsBuffer); | ||
const hashArray = Array.from(new Uint8Array(hashBuffer)); | ||
const hash = hashArray | ||
.map((item) => item.toString(16).padStart(2, "0")) | ||
.join(""); | ||
|
||
const len = Buffer.byteLength(entity, 'utf8'); | ||
|
||
return len.toString(16) + '-' + Buffer.from(hash).toString('base64').substring(0, 27); | ||
export const etag = async (input: { data: any, version: string }): Promise<string> => { | ||
return `${input.version}-${hash(input.data)}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.