Minor formatting

This commit is contained in:
Alexander Borsuk 2021-06-13 00:02:13 +02:00
parent 1fd4e34d7f
commit ea3efbc6b5
3 changed files with 5 additions and 6 deletions

2
src/bindings.d.ts vendored
View file

@ -1,4 +1,4 @@
export { };
export {};
// Defined in wrangler.toml
declare global {

View file

@ -20,7 +20,7 @@ export async function onGe0Decode(template: string, url: string): Promise<Respon
let title = 'Organic Maps';
if (name) {
name = decodeURIComponent(name.replace(/\+|_/g, ' '));
name = name.replace("'", '&rsquo;'); // To embed in popup.
name = name.replace("'", '&rsquo;'); // To embed in popup.
title = name + ' | ' + title;
} else {
name = 'Shared via <a href="https://organicmaps.app">Organic Maps app</a>';
@ -30,7 +30,7 @@ export async function onGe0Decode(template: string, url: string): Promise<Respon
...llz,
title,
name,
path: pathname + search + hash, // Starts with a slash
path: pathname + search + hash, // Starts with a slash
});
return new Response(template, { headers: { 'content-type': 'text/html' } });
}

View file

@ -55,8 +55,7 @@ async function handleFetchEvent(event: FetchEvent) {
// First, process all known redirects.
if ((DEBUG || hostname === 'omaps.app') && pathname in OMAPS_REWRITE_RULES) {
if (OMAPS_REWRITE_RULES[pathname].startsWith('http'))
return Response.redirect(OMAPS_REWRITE_RULES[pathname], 302);
if (OMAPS_REWRITE_RULES[pathname].startsWith('http')) return Response.redirect(OMAPS_REWRITE_RULES[pathname], 302);
}
// See https://github.com/cloudflare/kv-asset-handler#optional-arguments
@ -75,7 +74,7 @@ async function handleFetchEvent(event: FetchEvent) {
// Try to return a static resource first.
try {
return await getAssetFromKV(event, getAssetOptions);
} catch (_) { }
} catch (_) {}
// No static resource were found, try to handle a specific dynamic request.
getAssetOptions.mapRequestToAsset = (request: Request) => {
const url = new URL(request.url);