Test sea assets
This commit is contained in:
parent
778cd553c0
commit
3818428a8b
|
@ -86,7 +86,9 @@ async function start({server_port}) {
|
||||||
|
|
||||||
function addHandlers() {
|
function addHandlers() {
|
||||||
app.use(express.urlencoded({extended:true, limit: '50mb'}));
|
app.use(express.urlencoded({extended:true, limit: '50mb'}));
|
||||||
app.use(express.static(SITE_PATH));
|
if ( !sea.isSea() ) {
|
||||||
|
app.use(express.static(SITE_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
if ( args.library_path() ) {
|
if ( args.library_path() ) {
|
||||||
app.use("/library", express.static(args.library_path()))
|
app.use("/library", express.static(args.library_path()))
|
||||||
|
@ -251,6 +253,19 @@ function addHandlers() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ( sea.isSea() ) {
|
||||||
|
app.get('*', async (req, res) => {
|
||||||
|
const path = req.path;
|
||||||
|
const asset = sea.getAsset(path.slice(1)) || sea.getAsset(path.slice(1) +'.html');
|
||||||
|
if ( asset ) {
|
||||||
|
res.type(path.split('.').pop());
|
||||||
|
res.send(asset);
|
||||||
|
} else {
|
||||||
|
res.status(404).send('Not found');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stop() {
|
async function stop() {
|
||||||
|
|
13
test.sh
13
test.sh
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
EXE_NAME=$1
|
EXE_NAME="$1"
|
||||||
JS_SOURCE_FILE=$2
|
JS_SOURCE_FILE="$2"
|
||||||
OUTPUT_FOLDER=$3
|
OUTPUT_FOLDER="$3"
|
||||||
|
|
||||||
# Ensure nvm is installed
|
# Ensure nvm is installed
|
||||||
if ! command -v nvm &> /dev/null
|
if ! command -v nvm &> /dev/null
|
||||||
|
@ -24,8 +24,11 @@ cat <<EOF > sea-config.json
|
||||||
"main": "${JS_SOURCE_FILE}",
|
"main": "${JS_SOURCE_FILE}",
|
||||||
"output": "sea-prep.blob",
|
"output": "sea-prep.blob",
|
||||||
"assets": {
|
"assets": {
|
||||||
"public": "public/**/*",
|
"index.html": "public/index.html",
|
||||||
"vendor": "build/vendor/**/*"
|
"top.html": "public/top.html",
|
||||||
|
"style.css": "public/style.css",
|
||||||
|
"injection.js": "public/injection.js",
|
||||||
|
"redirector.html": "public/redirector.html"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in New Issue