From 351a696e710370456465a4fd05f9c7449b012571 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 25 Nov 2022 20:34:32 +0100 Subject: [PATCH] fix: Add redirects to old demos. (#6657) --- appengine/app.yaml | 53 ++++++++++++++++++++++++++++++++++++++++- appengine/redirect.html | 44 +++++++++++++++++++--------------- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/appengine/app.yaml b/appengine/app.yaml index 2fd93c494..1778f2b93 100644 --- a/appengine/app.yaml +++ b/appengine/app.yaml @@ -14,6 +14,58 @@ handlers: - url: /static/apps/.* static_files: redirect.html upload: redirect.html +# Certain demos were moved on 25 Nov 2022. +- url: /static/demos/fixed/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/resizable/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/toolbox/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/maxBlocks/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/generator/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/headless/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/interpreter/step-execution.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/interpreter/async-execution.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/graph/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/rtl/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/custom-dialogs/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/custom-fields/turtle/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/custom-fields/pitch/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/mirror/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/plane/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/keyboard_nav/.* + static_files: redirect.html + upload: redirect.html +- url: /static/demos/custom-fields/.* + static_files: redirect.html + upload: redirect.html # Blockly files. - url: /static @@ -50,4 +102,3 @@ handlers: - url: /.* script: auto secure: always - \ No newline at end of file diff --git a/appengine/redirect.html b/appengine/redirect.html index 63d892d71..cc7cf3018 100644 --- a/appengine/redirect.html +++ b/appengine/redirect.html @@ -47,51 +47,57 @@ if (loc.match('/apps/plane/plane.html')) { } } -if (loc.match('/apps/puzzle/')) { +if (loc.includes('/apps/puzzle/')) { // Puzzle moved to Blockly Games on 15 Oct 2014. loc = 'https://blockly.games/puzzle'; -} else if (loc.match('/apps/maze/')) { +} else if (loc.includes('/apps/maze/')) { // Maze moved to Blockly Games on 10 Nov 2014. loc = 'https://blockly.games/maze'; -} else if (loc.match('/apps/turtle/')) { +} else if (loc.includes('/apps/turtle/')) { // Turtle moved to Blockly Games on 10 Nov 2014. loc = 'https://blockly.games/turtle'; -} else if (loc.match('/apps/')) { +} else if (loc.includes('/apps/')) { // Remaining apps moved to demos on 20 Nov 2014. loc = loc.replace('/apps/', '/demos/'); } // Demos without saved data were moved to Blockly Samples in 2021. -if (loc.match('/demos/fixed/')) { +if (loc.includes('/demos/fixed/')) { loc = 'https://google.github.io/blockly-samples/examples/fixed-demo/'; -} else if (loc.match('/demos/resizable/')) { +} else if (loc.includes('/demos/resizable/overlay')) { + loc = 'https://google.github.io/blockly-samples/examples/resizable-demo/overlay.html'; +} else if (loc.includes('/demos/resizable/')) { loc = 'https://google.github.io/blockly-samples/examples/resizable-demo/'; -} else if (loc.match('/demos/toolbox/')) { +} else if (loc.includes('/demos/toolbox/')) { loc = 'https://google.github.io/blockly-samples/examples/toolbox-demo/'; -} else if (loc.match('/demos/maxBlocks/')) { +} else if (loc.includes('/demos/maxBlocks/')) { loc = 'https://google.github.io/blockly-samples/examples/max-blocks-demo/'; -} else if (loc.match('/demos/generator/')) { +} else if (loc.includes('/demos/generator/')) { loc = 'https://google.github.io/blockly-samples/examples/generator-demo/'; -} else if (loc.match('/demos/headless/')) { +} else if (loc.includes('/demos/headless/')) { loc = 'https://google.github.io/blockly-samples/examples/headless-demo/'; -} else if (loc.match('/demos/interpreter/step-execution')) { +} else if (loc.includes('/demos/interpreter/step-execution')) { loc = 'https://google.github.io/blockly-samples/examples/interpreter-demo/step-execution.html'; -} else if (loc.match('/demos/interpreter/async-execution')) { +} else if (loc.includes('/demos/interpreter/async-execution')) { loc = 'https://google.github.io/blockly-samples/examples/interpreter-demo/async-execution.html'; -} else if (loc.match('/demos/graph/')) { +} else if (loc.includes('/demos/graph/')) { loc = 'https://google.github.io/blockly-samples/examples/graph-demo/'; -} else if (loc.match('/demos/rtl/')) { +} else if (loc.includes('/demos/rtl/')) { loc = 'https://google.github.io/blockly-samples/examples/rtl-demo/'; -} else if (loc.match('/demos/custom-dialogs/')) { +} else if (loc.includes('/demos/custom-dialogs/')) { loc = 'https://google.github.io/blockly-samples/examples/custom-dialogs-demo'; -} else if (loc.match('/demos/custom-fields/turtle/')) { +} else if (loc.includes('/demos/custom-fields/turtle/')) { loc = 'https://google.github.io/blockly-samples/examples/turtle-field-demo/'; -} else if (loc.match('/demos/custom-fields/pitch/')) { +} else if (loc.includes('/demos/custom-fields/pitch/')) { loc = 'https://google.github.io/blockly-samples/examples/pitch-field-demo/'; -} else if (loc.match('/demos/mirror/')) { +} else if (loc.includes('/demos/mirror/')) { loc = 'https://google.github.io/blockly-samples/examples/mirror-demo/'; -} else if (loc.match('/demos/plane/')) { +} else if (loc.includes('/demos/plane/')) { loc = 'https://google.github.io/blockly-samples/examples/plane-demo/'; +} else if (loc.includes('/demos/keyboard_nav/')) { + loc = 'https://google.github.io/blockly-samples/plugins/keyboard-navigation/test/'; +} else if (loc.includes('/demos/custom-fields/')) { + loc = 'https://google.github.io/blockly-samples/examples/pitch-field-demo/'; } location = loc;