This repository was archived by the owner on Dec 15, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 11{
22 "demo" : false ,
3+ "demoContent" : [
4+ {
5+ "regex" : " \\ .(gif|jpe?g|tiff|png)$" ,
6+ "url" : " https://raw.githubusercontent.com/Simonwep/vue-cloudfront/master/public/img/icons/android-chrome-512x512.png"
7+ },
8+ {
9+ "regex" : " \\ .(mp3|adts|ogg|webp|flac)$" ,
10+ "url" : " https://github.com/9530f/stuff/blob/master/music_for_programming_1-datassette.mp3?raw=true"
11+ },
12+ {
13+ "regex" : " \\ .(mp4|wav|webm)$" ,
14+ "url" : " https://github.com/9530f/stuff/blob/master/Spinning%20Levers%201936%20-%20How%20A%20Transmission%20Works.mp4?raw=true"
15+ },
16+ {
17+ "regex" : " \\ .(ttf|otf|woff|woff2|eot)$" ,
18+ "url" : " https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2"
19+ }
20+ ],
321 "server" : {
422 "port" : 8080 ,
523 "storagePath" : " ./_storage" ,
Original file line number Diff line number Diff line change @@ -20,6 +20,17 @@ module.exports = async (req, res) => {
2020 return res . status ( 404 ) . send ( ) ;
2121 }
2222
23+ // Check if in demo mode
24+ if ( _config . demo ) {
25+ const { name} = node ;
26+
27+ for ( const { regex, url} of _config . demoContent ) {
28+ if ( name . match ( new RegExp ( regex , 'i' ) ) ) {
29+ return res . redirect ( url ) ;
30+ }
31+ }
32+ }
33+
2334 // Make sure the file exists
2435 const path = `${ _config . server . storagePath } /${ node . id } ` ;
2536 if ( fs . existsSync ( path ) ) {
You can’t perform that action at this time.
0 commit comments