diff --git a/README.md b/README.md index 69c500f..17c823d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# Cubiks-2048_ynh -Clone of 2048 game in 3D +# Cubiks-2048 game + +A clone of 2048 game in 3D +* [Try the game](https://kshitij-banerjee.github.io/Cubiks-2048/) +* [Repository](https://github.com/Kshitij-Banerjee/Cubiks-2048) + + diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..8ec2b2d --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,13 @@ +location YNH_WWW_PATH { + alias YNH_WWW_ALIAS ; + + # Force https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + index index.html; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..6f463f8 --- /dev/null +++ b/manifest.json @@ -0,0 +1,43 @@ +{ + "name": "Cubiks-2048", + "id": "cubiks2048", + "description": { + "en": "2048 game clone in 3D", + "fr": "Clone du jeu 2048 en 3D" + }, + "developer": { + "name": "Moul", + "email": "moul@moul.re" + }, + "multi_instance": "false", + "arguments": { + "install" : [ + { + "name": "domain", + "ask": { + "en": "Choose a domain for Cubiks-2048", + "fr": "Choisissez un nom de domaine pour Cubiks-2048" + }, + "example": "domain.org" + }, + { + "name": "path", + "ask": { + "en": "Choose a path for Cubiks-2048", + "fr": "Choisissez un chemin pour Cubiks-2048" + }, + "example": "/cubiks2048", + "default": "/cubiks2048" + }, + { + "name": "is_public", + "ask": { + "en": "Is it a public game?", + "fr": "Est-ce un jeu public ?" + }, + "choices": ["Yes", "No"], + "default": "Yes" + } + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100755 index 0000000..111bd76 --- /dev/null +++ b/scripts/install @@ -0,0 +1,41 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +path=$2 +is_public=$3 + +# Check domain/path availability +sudo yunohost app checkurl $domain$path -a cubiks2048 +if [[ ! $? -eq 0 ]]; then + exit 1 +fi + + +# Save app settings +sudo yunohost app setting cubiks2048 is_public -v "$is_public" + +# Copy files to the right place +final_path=/var/www/cubiks2048 +sudo mkdir -p $final_path +sudo cp -a ../sources/* $final_path + +# Set permissions +sudo chown -R www-data: $final_path + +# Modify Nginx configuration file and copy it to Nginx conf directory +sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf +sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf +nginxconf=/etc/nginx/conf.d/$domain.d/cubiks2048.conf +sudo cp ../conf/nginx.conf $nginxconf +sudo chown root: $nginxconf +sudo chmod 600 $nginxconf + +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting cubiks2048 skipped_uris -v "/" +fi + +# Reload web server & sso +sudo service nginx reload +sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove new file mode 100755 index 0000000..3e2f6cd --- /dev/null +++ b/scripts/remove @@ -0,0 +1,6 @@ +#!/bin/bash + +domain=$(sudo yunohost app setting cubiks2048 domain) + +sudo rm -rf /var/www/cubiks2048 +sudo rm -f /etc/nginx/conf.d/$domain.d/cubiks2048.conf diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..b9c2d75 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,34 @@ +#!/bin/bash + +# Retrieve settings +domain=$(sudo yunohost app setting cubiks2048 domain) +path=$(sudo yunohost app setting cubiks2048 path) +is_public=$(sudo yunohost app setting cubiks2048 is_public) + +# Remove trailing "/" for next commands +path=${path%/} + +# Copy files to the right place +final_path=/var/www/cubiks2048 +sudo mkdir -p $final_path +sudo cp -a ../sources/* $final_path + +# Set permissions +sudo chown -R www-data: $final_path + +# Modify Nginx configuration file and copy it to Nginx conf directory +sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf +sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf +nginxconf=/etc/nginx/conf.d/$domain.d/cubiks2048.conf +sudo cp ../conf/nginx.conf $nginxconf +sudo chown root: $nginxconf +sudo chmod 600 $nginxconf + +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting cubiks2048 skipped_uris -v "/" +fi + +# Reload web server & sso +sudo service nginx reload +sudo yunohost app ssowatconf diff --git a/sources b/sources new file mode 160000 index 0000000..df23698 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +Subproject commit df2369883cc1a6af96370758c91196ddd593fd8c