mirror of
https://github.com/YunoHost-Apps/lingva_ynh.git
synced 2024-09-03 19:36:20 +02:00
penyederhanaan
This commit is contained in:
parent
5e8fe8b964
commit
a2e4e64534
4 changed files with 84 additions and 7 deletions
28
conf/manifest.json
Normal file
28
conf/manifest.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "Lingva Translate",
|
||||
"short_name": "Lingva",
|
||||
"start_url": "__NEXT_PATH__/",
|
||||
"scope": "__NEXT_PATH__/",
|
||||
"display": "standalone",
|
||||
"lang": "en",
|
||||
"icons": [
|
||||
{
|
||||
"src": "__NEXT_PATH__/favicon-192x192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "__NEXT_PATH__/favicon-512x512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
},
|
||||
{
|
||||
"src": "__NEXT_PATH__/favicon-maskable.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"background_color": "#bde3cb",
|
||||
"theme_color": "#bde3cb"
|
||||
}
|
25
conf/next.config.js
Normal file
25
conf/next.config.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const withPWA = require("next-pwa");
|
||||
|
||||
module.exports = withPWA({
|
||||
swcMinify: true,
|
||||
pwa: {
|
||||
dest: "public"
|
||||
},
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)",
|
||||
headers: [
|
||||
{
|
||||
key: "Permissions-Policy",
|
||||
value: "interest-cohort=()"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
basePath: '__NEXT_PATH__',
|
||||
};
|
|
@ -48,13 +48,18 @@ chown $app:$app "$install_dir/.env.local"
|
|||
# CONFIGURATION FOR SUBPATH
|
||||
#=================================================
|
||||
|
||||
rm "$install_dir/public/manifest.json"
|
||||
rm "$install_dir/next.config.js"
|
||||
|
||||
if [ "$path" = "/" ]; then
|
||||
next_path=""
|
||||
else
|
||||
next_path=$path
|
||||
fi
|
||||
|
||||
echo "module.exports = { basePath: '$next_path', };" >> "$install_dir/next.config.js"
|
||||
ynh_add_config --template="manifest.json" --destination="$install_dir/public/manifest.json"
|
||||
|
||||
ynh_add_config --template="next.config.js" --destination="$install_dir/next.config.js"
|
||||
|
||||
ynh_replace_string --match_string="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace_string="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --target_file="$install_dir/components/Header.tsx"
|
||||
|
||||
|
@ -64,12 +69,6 @@ ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next
|
|||
|
||||
ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx"
|
||||
|
||||
ynh_replace_string --match_string="start_url\": \"/" --replace_string="start_url\": \"$next_path/" --target_file="$install_dir/public/manifest.json"
|
||||
|
||||
ynh_replace_string --match_string="scope\": \"/" --replace_string="scope\": \"$next_path/" --target_file="$install_dir/public/manifest.json"
|
||||
|
||||
ynh_replace_string --match_string="src\": \"/favicon" --replace_string="src\": \"$next_path/favicon" --target_file="$install_dir/public/manifest.json"
|
||||
|
||||
#=================================================
|
||||
# BUILD AND INSTALL THE APP
|
||||
#=================================================
|
||||
|
|
|
@ -106,6 +106,31 @@ ynh_add_config --template=".env.local" --destination="$install_dir/.env.local"
|
|||
chmod 400 "$install_dir/.env.local"
|
||||
chown $app:$app "$install_dir/.env.local"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURATION FOR SUBPATH
|
||||
#=================================================
|
||||
|
||||
rm "$install_dir/public/manifest.json"
|
||||
rm "$install_dir/next.config.js"
|
||||
|
||||
if [ "$path" = "/" ]; then
|
||||
next_path=""
|
||||
else
|
||||
next_path=$path
|
||||
fi
|
||||
|
||||
ynh_add_config --template="manifest.json" --destination="$install_dir/public/manifest.json"
|
||||
|
||||
ynh_add_config --template="next.config.js" --destination="$install_dir/next.config.js"
|
||||
|
||||
ynh_replace_string --match_string="src={useColorModeValue(\"/banner_light.svg\", \"/banner_dark.svg\")}" --replace_string="src={useColorModeValue(\"$next_path/banner_light.svg\", \"$next_path/banner_dark.svg\")}" --target_file="$install_dir/components/Header.tsx"
|
||||
|
||||
ynh_replace_string --match_string="href=\"/favicon" --replace_string="href=\"$next_path/favicon" --target_file="$install_dir/components/CustomHead.tsx"
|
||||
|
||||
ynh_replace_string --match_string="href=\"/apple" --replace_string="href=\"$next_path/apple" --target_file="$install_dir/components/CustomHead.tsx"
|
||||
|
||||
ynh_replace_string --match_string="href=\"/manifest" --replace_string="href=\"$next_path/manifest" --target_file="$install_dir/components/CustomHead.tsx"
|
||||
|
||||
#=================================================
|
||||
# REBUILD AND INSTALL THE APP
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue