mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 20:13:46 -05:00
Merge pull request #8641 from overleaf/jpa-pdf-caching-refresh
[web] serviceWorker: add support for zonal pdf downloads GitOrigin-RevId: 490ff38ded19ebe32755b708e6ac270babfa519f
This commit is contained in:
parent
da02a4f2be
commit
9fba03e70a
1 changed files with 5 additions and 3 deletions
|
@ -8,7 +8,8 @@ const VERSION = 2
|
||||||
|
|
||||||
const CLEAR_CACHE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/output$/
|
const CLEAR_CACHE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/output$/
|
||||||
const COMPILE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/compile$/
|
const COMPILE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/compile$/
|
||||||
const PDF_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/.*\/output.pdf$/
|
const PDF_REQUEST_MATCHER =
|
||||||
|
/^(\/zone\/.)?(\/project\/[0-9a-f]{24}\/.*\/output.pdf)$/
|
||||||
const PDF_JS_CHUNK_SIZE = 128 * 1024
|
const PDF_JS_CHUNK_SIZE = 128 * 1024
|
||||||
const MAX_SUBREQUEST_COUNT = 4
|
const MAX_SUBREQUEST_COUNT = 4
|
||||||
const MAX_SUBREQUEST_BYTES = 4 * PDF_JS_CHUNK_SIZE
|
const MAX_SUBREQUEST_BYTES = 4 * PDF_JS_CHUNK_SIZE
|
||||||
|
@ -162,8 +163,9 @@ function onFetch(event) {
|
||||||
return processCompileRequest(event)
|
return processCompileRequest(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.match(PDF_REQUEST_MATCHER)) {
|
const match = path.match(PDF_REQUEST_MATCHER)
|
||||||
const ctx = getPdfContext(event.clientId, path)
|
if (match) {
|
||||||
|
const ctx = getPdfContext(event.clientId, match[2])
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
return processPdfRequest(event, ctx)
|
return processPdfRequest(event, ctx)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue