Skip to content

Commit

Permalink
Merge branch 'testing' into pr/407
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgaspar committed Jun 11, 2023
2 parents 0339315 + 8f09386 commit 4f1deba
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 163 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ this package:
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal


**Shipped version:** 25.0.4~ynh1
**Shipped version:** 26.0.2~ynh3

**Demo:** https://demo.nextcloud.com/

Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv
* Utilise l'adresse `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - par exemple, Baïkal


**Version incluse :** 25.0.4~ynh1
**Version incluse :** 26.0.2~ynh3

**Démo :** https://demo.nextcloud.com/

Expand Down
17 changes: 0 additions & 17 deletions actions.toml

This file was deleted.

20 changes: 16 additions & 4 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ location ^~ __PATH__/ {
more_set_headers "X-Download-Options: noopen";
more_set_headers "X-Frame-Options: SAMEORIGIN";
more_set_headers "X-Permitted-Cross-Domain-Policies: none";
more_set_headers "X-Robots-Tag: none";
more_set_headers "X-Robots-Tag: noindex, nofollow";
more_set_headers "X-XSS-Protection: 1; mode=block";

# Set max upload size
Expand Down Expand Up @@ -77,7 +77,7 @@ location ^~ __PATH__/ {

# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }

# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
Expand All @@ -88,14 +88,17 @@ location ^~ __PATH__/ {
# https://github.com/nextcloud/documentation/pull/2197#issuecomment-721432337
# This line fix the ldap admin page
rewrite ^__PATH__/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) __PATH__/index.php$request_uri;

fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;

try_files $fastcgi_script_name =404;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;

fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_param HTTP_ACCEPT_ENCODING ""; # Disable encoding of nextcloud response to inject ynh scripts
Expand All @@ -104,10 +107,19 @@ location ^~ __PATH__/ {
fastcgi_request_buffering off;
}

location ~ \.(?:css|js|svg|gif)$ {
location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}

location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
try_files $uri / __PATH__/index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets

location ~ \.wasm$ {
default_type application/wasm;
}
}

location ~ \.woff2?$ {
Expand Down
8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"en": "Online storage, file sharing platform and various other applications",
"fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications"
},
"version": "25.0.4~ynh1",
"version": "26.0.2~ynh3",
"url": "https://nextcloud.com",
"upstream": {
"license": "AGPL-3.0",
Expand All @@ -23,7 +23,7 @@
"email": "[email protected]"
},
"requirements": {
"yunohost": ">= 11.0.9"
"yunohost": ">= 11.1.15"
},
"multi_instance": true,
"services": [
Expand Down Expand Up @@ -51,8 +51,8 @@
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Nextcloud will be accessible by Nextcloud Desktop and by users without a YunoHost account. This can be changed later in the webadmin.",
"fr": "Si cette case est cochée, Nextcloud sera accessible par Nextcloud Desktop et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer dans la webadmin."
"en": "You need to enable public if you want to connect Nextcloud Desktop client to Nextcloud server. This can be changed later via the webadmin.",
"fr": "Vous devez cocher cette case si vous souhaitez connecter le client Nextcloud Desktop au serveur Nextcloud. Cela peut être modifié ultérieurement via l'administrateur Web."

This comment has been minimized.

Copy link
@lapineige

lapineige Jun 11, 2023

Member

Translation is not the same as original content + it's not very compatible with command line interface (you don't "tick" anything in CLI)
-> "Vous devez activer cette option"

This comment has been minimized.

Copy link
@ericgaspar

ericgaspar Jun 11, 2023

Author Member

fell free to add a PR

This comment has been minimized.

Copy link
@lapineige

lapineige Jun 11, 2023

Member

I realize it's changed in v2 version, so it's fine.

},
"default": true
},
Expand Down
36 changes: 36 additions & 0 deletions scripts/_ynh_mysql_connect_as.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Open a connection as a user
#
# example: ynh_mysql_connect_as --user="user" --password="pass" <<< "UPDATE ...;"
# example: ynh_mysql_connect_as --user="user" --password="pass" --default_character_set="utf8mb4" < /path/to/file.sql
#
# usage: ynh_mysql_connect_as --user=user --password=password [--database=database] [--default_character_set=character-set]
# | arg: -u, --user= - the user name to connect as
# | arg: -p, --password= - the user password
# | arg: -d, --database= - the database to connect to
# | arg: -c, --default_character_set= - the charset to use
#
# Requires YunoHost version 2.2.4 or higher.
ynh_mysql_connect_as() {
# Declare an array to define the options of this helper.
local legacy_args=updc
local -A args_array=( [u]=user= [p]=password= [d]=database= [c]=default_character_set= )
local user
local password
local database
local default_character_set
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
database="${database:-}"
default_character_set="${default_character_set:-}"

if [ -n "$default_character_set" ]
then
default_character_set="--default-character-set=$default_character_set"
else
default_character_set="--default-character-set=latin1"
fi

mysql --user="$user" --password="$password" "$default_character_set" --batch "$database"
}
37 changes: 37 additions & 0 deletions scripts/_ynh_mysql_dump_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Dump a database
#
# example: ynh_mysql_dump_db --database=roundcube --default_character_set="utf8mb4" > ./dump.sql
#
# usage: ynh_mysql_dump_db --database=database
# | arg: -d, --database= - the database name to dump
# | arg: -c, --default_character_set= - the charset to use
# | ret: the mysqldump output
#
# Requires YunoHost version 2.2.4 or higher.
ynh_mysql_dump_db() {
# Declare an array to define the options of this helper.
local legacy_args=dc
local -A args_array=( [d]=database= [c]=default_character_set= )
local database
local default_character_set
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
default_character_set="${default_character_set:-}"
MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql

if [ -n "$default_character_set" ]
then
default_character_set="--default-character-set=$default_character_set"
else
# By default, default character set is "latin1"
default_character_set="--default-character-set=latin1"
fi

if [ -f "$MYSQL_ROOT_PWD_FILE" ]; then
mysqldump --user="root" --password="$(cat $MYSQL_ROOT_PWD_FILE)" --single-transaction --skip-dump-date "$default_character_set" "$database"
else
mysqldump --single-transaction --skip-dump-date "$default_character_set" "$database"
fi
}
66 changes: 0 additions & 66 deletions scripts/actions/add_multimedia_directories

This file was deleted.

52 changes: 0 additions & 52 deletions scripts/actions/disable_maintenance

This file was deleted.

3 changes: 2 additions & 1 deletion scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/_ynh_mysql_dump_db.sh

#=================================================
# MANAGE SCRIPT FAILURE
Expand Down Expand Up @@ -57,7 +58,7 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
ynh_print_info --message="Backing up the MySQL database..."

ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db --database="$db_name" --default_character_set="utf8mb4" > db.sql

#=================================================
# SPECIFIC BACKUP
Expand Down
17 changes: 12 additions & 5 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

source _common.sh
source /usr/share/yunohost/helpers
source _ynh_mysql_connect_as.sh

#=================================================
# MANAGE SCRIPT FAILURE
Expand Down Expand Up @@ -78,6 +79,9 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name

ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
Expand Down Expand Up @@ -190,6 +194,9 @@ exec_occ maintenance:install \
#=================================================
ynh_script_progression --message="Configuring Nextcloud..." --weight=8

# Set the mysql.utf8mb4 config to true in config.php
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"

# Ensure that UpdateNotification app is disabled
exec_occ app:disable updatenotification

Expand Down Expand Up @@ -275,7 +282,7 @@ exec_occ config:system:set overwrite.cli.url --value="https://${domain}"
#=================================================

# Set the user as admin
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name --default_character_set="utf8mb4" \
<<< "INSERT INTO oc_group_user VALUES ('admin','$admin');"
# And delete admin user
exec_occ user:delete admin
Expand Down Expand Up @@ -329,10 +336,10 @@ ynh_multimedia_addaccess $app
# Fix app ownerships & permissions
chown -R $app:www-data "$final_path"
chown -R $app: "$datadir"
find $final_path/ -type f -print0 | xargs -0 chmod 0644
find $final_path/ -type d -print0 | xargs -0 chmod 0755
find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
find $final_path/ -type f -print0 | xargs -r0 chmod 0644
find $final_path/ -type d -print0 | xargs -r0 chmod 0755
find $datadir/ -type f -print0 | xargs -r0 chmod 0640
find $datadir/ -type d -print0 | xargs -r0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
chmod 750 $final_path
Expand Down
Loading

0 comments on commit 4f1deba

Please sign in to comment.