mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-18 09:39:30 -07:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2db7f30de7 | ||
|
|
5c7a6ab1a4 | ||
|
|
4b63328b74 | ||
|
|
ae1d004f60 | ||
|
|
7dd4c1dd24 | ||
|
|
1120247c99 |
@@ -89,6 +89,7 @@ const mjsSources = [
|
|||||||
'server/scripts/modules/travelforecast.mjs',
|
'server/scripts/modules/travelforecast.mjs',
|
||||||
'server/scripts/modules/progress.mjs',
|
'server/scripts/modules/progress.mjs',
|
||||||
'server/scripts/modules/media.mjs',
|
'server/scripts/modules/media.mjs',
|
||||||
|
'server/scripts/modules/custom-rss-feed.mjs',
|
||||||
'server/scripts/index.mjs',
|
'server/scripts/index.mjs',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
715
package-lock.json
generated
715
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ws4kp",
|
"name": "ws4kp",
|
||||||
"version": "5.27.0",
|
"version": "5.27.1",
|
||||||
"description": "Welcome to the WeatherStar 4000+ project page!",
|
"description": "Welcome to the WeatherStar 4000+ project page!",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
"webpack-stream": "^7.0.0"
|
"webpack-stream": "^7.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^16.5.0",
|
"dotenv": "^17.0.1",
|
||||||
"ejs": "^3.1.5",
|
"ejs": "^3.1.5",
|
||||||
"express": "^5.1.0"
|
"express": "^5.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,11 @@ const getFeed = async (url) => {
|
|||||||
// this returns a data url
|
// this returns a data url
|
||||||
// a few sanity checks
|
// a few sanity checks
|
||||||
if (rssResponse.status.content_type.indexOf('xml') < 0) return;
|
if (rssResponse.status.content_type.indexOf('xml') < 0) return;
|
||||||
if (rssResponse.contents.indexOf('base64') > 100) return;
|
// determine return type
|
||||||
|
const isBase64 = rssResponse.status.content_type.substring(0, 8) !== 'text/xml';
|
||||||
|
|
||||||
// base 64 decode everything after the comma
|
// base 64 decode everything after the comma
|
||||||
const rss = atob(rssResponse.contents.split('base64,')[1]);
|
const rss = isBase64 ? atob(rssResponse.contents.split('base64,')[1]) : rssResponse.contents;
|
||||||
|
|
||||||
// parse the rss
|
// parse the rss
|
||||||
const doc = parser.parseFromString(rss, 'text/xml');
|
const doc = parser.parseFromString(rss, 'text/xml');
|
||||||
|
|||||||
35
static-env-handler.sh
Normal file → Executable file
35
static-env-handler.sh
Normal file → Executable file
@@ -4,22 +4,27 @@ set -eu
|
|||||||
ROOT="/usr/share/nginx/html"
|
ROOT="/usr/share/nginx/html"
|
||||||
QS=""
|
QS=""
|
||||||
|
|
||||||
|
# URL encode a string
|
||||||
|
url_encode() {
|
||||||
|
local string="$1"
|
||||||
|
printf '%s' "$string" | sed 's/ /%20/g; s/"/%22/g; s/</%3C/g; s/>/%3E/g; s/&/%26/g; s/#/%23/g; s/+/%2B/g'
|
||||||
|
}
|
||||||
|
|
||||||
# build query string from WSQS_ env vars
|
# build query string from WSQS_ env vars
|
||||||
for var in $(env); do
|
while IFS='=' read -r key val; do
|
||||||
case "$var" in
|
# Remove WSQS_ prefix and convert underscores to hyphens
|
||||||
WSQS_*=*)
|
key="${key#WSQS_}"
|
||||||
key="${var%%=*}"
|
key="${key//_/-}"
|
||||||
val="${var#*=}"
|
# URL encode the value
|
||||||
key="${key#WSQS_}"
|
encoded_val=$(url_encode "$val")
|
||||||
key="${key//_/-}"
|
if [ -n "$QS" ]; then
|
||||||
if [ -n "$QS" ]; then
|
QS="$QS&${key}=${encoded_val}"
|
||||||
QS="$QS&${key}=${val}"
|
else
|
||||||
else
|
QS="${key}=${encoded_val}"
|
||||||
QS="${key}=${val}"
|
fi
|
||||||
fi
|
done << EOF
|
||||||
;;
|
$(env | grep '^WSQS_')
|
||||||
esac
|
EOF
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$QS" ]; then
|
if [ -n "$QS" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user