2024-04-15 01:30:58 +02:00
|
|
|
#!/bin/sh
|
2024-04-19 00:34:22 +02:00
|
|
|
SourceApps="SpiderADB WuppiMini"
|
2024-05-15 01:29:32 +02:00
|
|
|
HubSdkApps="${SourceApps} MatrixStickerHelper TiktOctt"
|
2024-04-21 00:58:00 +02:00
|
|
|
|
|
|
|
quoteVar(){ echo '"'"$1"'"' ;}
|
|
|
|
|
|
|
|
getMetaAttr(){
|
|
|
|
file="$1"
|
|
|
|
name="$2"
|
|
|
|
key="$([ -n "$3" ] && echo "$3" || echo "property")"
|
|
|
|
grep '<meta '"$key"'="'"$name"'"' "$file" | grep '>' | cut -d '"' -f4
|
|
|
|
}
|
2024-04-19 00:34:22 +02:00
|
|
|
|
|
|
|
rm -vrf ./public || true
|
|
|
|
cp -vr ./static ./public
|
|
|
|
cp -vr ./shared ./public/shared
|
|
|
|
|
2024-04-19 00:37:07 +02:00
|
|
|
for App in ${SourceApps}
|
2024-04-15 01:30:58 +02:00
|
|
|
do
|
2024-04-21 00:58:00 +02:00
|
|
|
mkdir -p "./public/${App}"
|
|
|
|
cd "./source/${App}"
|
2024-04-17 01:30:25 +02:00
|
|
|
sh ./Requirements.sh
|
2024-04-21 00:58:00 +02:00
|
|
|
cp -vr $(sh ./Build.sh) "../../public/${App}/"
|
2024-04-15 01:30:58 +02:00
|
|
|
cd ../..
|
|
|
|
done
|
2024-04-19 00:34:22 +02:00
|
|
|
|
2024-04-15 01:30:58 +02:00
|
|
|
cd ./public
|
|
|
|
node ../WriteRedirectPages.js
|
2024-04-19 00:34:22 +02:00
|
|
|
|
2024-04-19 00:37:07 +02:00
|
|
|
for App in ${HubSdkApps}
|
2024-04-19 00:34:22 +02:00
|
|
|
do
|
2024-04-21 00:58:00 +02:00
|
|
|
file="./${App}/index.html"
|
|
|
|
name="$(getMetaAttr "${file}" og:title)"
|
|
|
|
description="$(getMetaAttr "${file}" og:description property)"
|
|
|
|
url="$(getMetaAttr "${file}" Url OctoSpaccHubSdk)" #"$(getMetaAttr "${file}" og:url property)"
|
|
|
|
cat << [OctoSpaccHubSdk-WebManifest-EOF] > "./${App}/WebManifest.json"
|
|
|
|
{
|
|
|
|
$(getMetaAttr "${file}" WebManifestExtra OctoSpaccHubSdk | sed s/\'/\"/g)
|
|
|
|
$([ -n "${description}" ] && echo "$(quoteVar description): $(quoteVar "${description}"),")
|
|
|
|
"start_url": "${url}",
|
|
|
|
"scope": "${url}",
|
|
|
|
"name": "${name}"
|
|
|
|
}
|
|
|
|
[OctoSpaccHubSdk-WebManifest-EOF]
|
|
|
|
sed -i 's|</head>|<title>'"${name}"'</title><link rel="manifest" href="./WebManifest.json"/></head>|' "${file}"
|
2024-04-19 00:34:22 +02:00
|
|
|
done
|