mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02: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:
@@ -8,7 +8,8 @@ const VERSION = 2
|
||||
|
||||
const CLEAR_CACHE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/output$/
|
||||
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 MAX_SUBREQUEST_COUNT = 4
|
||||
const MAX_SUBREQUEST_BYTES = 4 * PDF_JS_CHUNK_SIZE
|
||||
@@ -162,8 +163,9 @@ function onFetch(event) {
|
||||
return processCompileRequest(event)
|
||||
}
|
||||
|
||||
if (path.match(PDF_REQUEST_MATCHER)) {
|
||||
const ctx = getPdfContext(event.clientId, path)
|
||||
const match = path.match(PDF_REQUEST_MATCHER)
|
||||
if (match) {
|
||||
const ctx = getPdfContext(event.clientId, match[2])
|
||||
if (ctx) {
|
||||
return processPdfRequest(event, ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user