1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shiori_ynh.git synced 2024-09-03 20:26:17 +02:00

Merge pull request #34 from navanchauhan/fixes-and-migrate-to-1_6_0

Update to 1.6.0 and add migrations
This commit is contained in:
eric_G 2024-03-19 22:53:54 +01:00 committed by GitHub
commit fdf20e5ad9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 50 additions and 11 deletions

View file

@ -1,7 +1,7 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__/;
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View file

@ -8,7 +8,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/shiori serve --port __PORT__ --webroot __PATH__ ExecStart=__INSTALL_DIR__/shiori server --port __PORT__ --webroot __PATH__
Restart=always Restart=always
Environment="SHIORI_DIR=__DATA_DIR__" Environment="SHIORI_DIR=__DATA_DIR__"

View file

@ -1 +1 @@
The default account is `shiori` with password `gopher`. It is removed once another 'owner' account is created. The default account is `shiori` with password `gopher`. Please manually remove it after you create your own account.

View file

@ -1 +1 @@
Le compte par défaut est `shiori` avec le mot de passe `gopher`. Il est supprimé une fois qu'un autre compte « propriétaire » est créé. Le compte par défaut est `shiori` avec le mot de passe `gopher`. Veuillez le supprimer manuellement après avoir créé votre propre compte.

View file

@ -5,7 +5,7 @@ name = "Shiori"
description.en = "Simple bookmark manager" description.en = "Simple bookmark manager"
description.fr = "Gestionnaire de liens simple" description.fr = "Gestionnaire de liens simple"
version = "1.5.5~ynh4" version = "1.6.0~ynh1"
maintainers = [] maintainers = []
@ -45,12 +45,12 @@ ram.runtime = "50M"
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
amd64.url = "https://github.com/go-shiori/shiori/releases/download/v1.5.5-rc.2/shiori_Linux_x86_64.tar.gz" amd64.url = "https://github.com/go-shiori/shiori/releases/download/v1.6.0/shiori_Linux_x86_64.tar.gz"
amd64.sha256 = "928adfc3d927b718c7bd75396bbb3a34cb542676374b6c89bb3da92063ac099c" amd64.sha256 = "3bcc7557db94d8d6d8f8940f9e37412f198c30f520642e817f4b38a6fee1822e"
arm64.url = "https://github.com/go-shiori/shiori/releases/download/v1.5.5-rc.2/shiori_Linux_aarch64.tar.gz" arm64.url = "https://github.com/go-shiori/shiori/releases/download/v1.6.0/shiori_Linux_aarch64.tar.gz"
arm64.sha256 = "98fc7c8114264b338838089a6ab7c4ce326224fac4f498b6ecc4bfab2d3d3c78" arm64.sha256 = "74add39dc22bd59dcfe467571688cac29dcc85da90d4b7e4ce668182d9081d34"
armhf.url = "https://github.com/go-shiori/shiori/releases/download/v1.5.5-rc.2/shiori_Linux_arm.tar.gz" armhf.url = "https://github.com/go-shiori/shiori/releases/download/v1.6.0/shiori_Linux_arm.tar.gz"
armhf.sha256 = "3ac24d434ff7a76bb3a8810e6c23caf28a7040c67756fec99a2483f04a197f77" armhf.sha256 = "55e8ae7136d39b7f09401b87c6e297695dc6efe1bb2b55c119ecaf540fdf4a19"
in_subdir = false in_subdir = false
autoupdate.strategy = "latest_github_release" autoupdate.strategy = "latest_github_release"
autoupdate.asset.amd64 = "^shiori_Linux_x86_64.tar.gz$" autoupdate.asset.amd64 = "^shiori_Linux_x86_64.tar.gz$"

View file

@ -21,6 +21,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir" ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE APP DATA DIR
#=================================================
ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -40,6 +40,39 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/shiori" chmod +x "$install_dir/shiori"
#=================================================
# MIGRATE AND UPGRADE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
if ynh_compare_current_package_version --comparison lt --version 1.50~ynh9
then
ynh_script_progression --message="Migrating sqlite from version < 1.50~ynh9..." --weight=1
FTS4_EXISTS=$(sqlite3 "$data_dir/shiori.db" "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'bookmark_content' AND sql LIKE '%USING fts4%';")
if [ -z "$FTS4_EXISTS" ]
then
echo "No FTS4 table found or already migrated"
else
sqlite3 "$data_dir/shiori.db" "BEGIN TRANSACTION; CREATE VIRTUAL TABLE bookmark_content_fts5 USING fts5(title, content, html, docid); INSERT INTO bookmark_content_fts5 (title, content, html, docid) SELECT title, content, html, docid FROM bookmark_content; DROP TABLE bookmark_content; ALTER TABLE bookmark_content_fts5 RENAME TO bookmark_content; COMMIT;"
fi
SCHEMA_MIGRATIONS_EXISTS=$(sqlite3 "$data_dir/shiori.db" "SELECT name FROM sqlite_master WHERE type='table' AND name='schema_migrations';")
if [ -z "$SCHEMA_MIGRATIONS_EXISTS" ]; then
echo "No schema_migrations table found, skipping"
else
DIRTY=$(sqlite3 "$data_dir/shiori.db" "SELECT dirty FROM schema_migrations WHERE dirty = 1;")
if [ -z "$DIRTY" ]; then
echo "No dirty migrations found, skipping"
else
VERSION=$(sqlite3 "$data_dir/shiori.db" "SELECT version FROM schema_migrations WHERE dirty = 1;")
NEW_VERSION=$((VERSION - 1))
sqlite3 "$data_dir/shiori.db" "UPDATE schema_migrations SET version = $NEW_VERSION, dirty = 0 WHERE dirty = 1;"
fi
fi
fi
fi
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================