Skip to content

Commit

Permalink
$mol_offline regexp to URL parser
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Nov 1, 2024
1 parent d12f71f commit a202b1b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions offline/offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ namespace $ {
throw new Error('implement')
}

static force_cache_regexp = /.+\/(index|test)\.html/

protected static async respond(request: Request) {
let fallback_header

const index_html = this.force_cache_regexp.test(request.url)
const url = new URL(request.url)
const html = url.pathname.endsWith('.html')

const cache = request.cache

if (cache === 'reload' || ( cache === 'no-cache' && ! index_html ) ) {
if (cache === 'reload' || ( cache === 'no-cache' && ! html ) ) {
if (cache === 'reload') {
// F5 + Disable cache
request = new Request(request, { cache: 'no-cache' })
Expand Down

0 comments on commit a202b1b

Please sign in to comment.