mirror of
https://github.com/YunoHost-Apps/yourls_ynh.git
synced 2024-09-03 20:35:59 +02:00
commit
b936455c2b
22 changed files with 549 additions and 428 deletions
77
README.md
77
README.md
|
@ -1,63 +1,48 @@
|
|||
# YOURLS for YunoHost
|
||||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Yourls for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/yourls.svg)](https://dash.yunohost.org/appci/app/yourls) ![](https://ci-apps.yunohost.org/ci/badges/yourls.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/yourls.maintain.svg)
|
||||
[![Install YOURLS with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=yourls)
|
||||
[![Install Yourls with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=yourls)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install YOURLS quickly and simply on a YunoHost server.
|
||||
> *This package allows you to install Yourls quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
||||
YOURLS stands for Your Own URL Shortener. It is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or bitly).
|
||||
|
||||
**Shipped version:** 1.8.1
|
||||
### YOURLS Features
|
||||
|
||||
- Free and open-source software,
|
||||
- Private (your links only) or Public (everybody can create short links, fine for an intranet),
|
||||
- Terrific Plugin architecture and dozens of plugins to easily implement new features,
|
||||
- Handy bookmarklets to easily shorten and share links,
|
||||
- Awesome stats: historical click reports, referrers tracking, visitors geo-location,
|
||||
- Developer API to integrate YOURLS into other applications,
|
||||
- Sample files to create your own public interface and more !
|
||||
|
||||
|
||||
**Shipped version:** 1.8.2~ynh1
|
||||
|
||||
**Demo:** https://yourls.org/cookie+
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](https://yourls.org/images/stats-anim.gif)
|
||||
![](./doc/screenshots/p4.png)
|
||||
|
||||
## Demo
|
||||
## Documentation and resources
|
||||
|
||||
* [Official demo](https://yourls.org/cookie+)
|
||||
|
||||
## Configuration
|
||||
|
||||
How to configure this app: From an admin panel, a plain file with SSH, or any other way.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: Link to the official documentation of this app
|
||||
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
* Are LDAP and HTTP auth supported?
|
||||
* Can the app be used by multiple users?
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/yourls%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/yourls/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/yourls%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/yourls/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Any known limitations.
|
||||
|
||||
## Additional information
|
||||
|
||||
* Other info you would like to add about this app.
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/yourls_ynh/issues
|
||||
* App website: https://yourls.org/
|
||||
* Upstream app repository: https://github.com/YOURLS/YOURLS
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
* Official app website: https://yourls.org/
|
||||
* Official admin documentation: https://github.com/YOURLS/YOURLS/wiki
|
||||
* Upstream app code repository: https://github.com/YOURLS/YOURLS
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_yourls
|
||||
* Report a bug: https://github.com/YunoHost-Apps/yourls_ynh/issues
|
||||
|
||||
## Developer info
|
||||
|
||||
|
@ -69,3 +54,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/yourls_ynh/tree/testi
|
|||
or
|
||||
sudo yunohost app upgrade yourls -u https://github.com/YunoHost-Apps/yourls_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
79
README_fr.md
79
README_fr.md
|
@ -1,63 +1,44 @@
|
|||
# YOURLS pour YunoHost
|
||||
# Yourls pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/yourls.svg)](https://dash.yunohost.org/appci/app/yourls) ![](https://ci-apps.yunohost.org/ci/badges/yourls.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/yourls.maintain.svg)
|
||||
[![Installer YOURLS avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=yourls)
|
||||
[![Installer Yourls avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=yourls)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer YOURLS rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
||||
> *Ce package vous permet d'installer Yourls rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
YOURLS signifie Your Own URL Shortener. C'est un petit ensemble de scripts PHP qui vous permettront d'exécuter votre propre service de raccourcissement d'URL (à la TinyURL ou bitly).
|
||||
|
||||
**Version incluse :** 1.8.1
|
||||
YOURLS stands for Your Own URL Shortener. It is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or bitly).
|
||||
|
||||
### YOURLS Features
|
||||
|
||||
- Free and open-source software,
|
||||
- Private (your links only) or Public (everybody can create short links, fine for an intranet),
|
||||
- Terrific Plugin architecture and dozens of plugins to easily implement new features,
|
||||
- Handy bookmarklets to easily shorten and share links,
|
||||
- Awesome stats: historical click reports, referrers tracking, visitors geo-location,
|
||||
- Developer API to integrate YOURLS into other applications,
|
||||
- Sample files to create your own public interface and more !
|
||||
|
||||
|
||||
**Version incluse :** 1.8.2~ynh1
|
||||
|
||||
**Démo :** https://yourls.org/cookie+
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](https://yourls.org/images/stats-anim.gif)
|
||||
![](./doc/screenshots/p4.png)
|
||||
|
||||
## Démo
|
||||
## Documentations et ressources
|
||||
|
||||
* [Official demo](https://yourls.org/cookie+)
|
||||
|
||||
## Configuration
|
||||
|
||||
How to configure this app: From an admin panel, a plain file with SSH, or any other way.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : Lien vers la documentation officielle de cette application.
|
||||
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
* L'authentification LDAP et HTTP est-elle prise en charge ?
|
||||
* L'application peut-elle être utilisée par plusieurs utilisateurs ?
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/yourls%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/yourls/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/yourls%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/yourls/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Limitations connues.
|
||||
|
||||
## Informations additionnelles
|
||||
|
||||
* Autres informations que vous souhaitez ajouter sur cette application.
|
||||
|
||||
## Links
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/yourls_ynh/issues
|
||||
* Site de l'application : https://yourls.org/
|
||||
* Dépôt de l'application principale : https://github.com/YOURLS/YOURLS
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : https://yourls.org/
|
||||
* Documentation officielle de l'admin : https://github.com/YOURLS/YOURLS/wiki
|
||||
* Dépôt de code officiel de l'app : https://github.com/YOURLS/YOURLS
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_yourls
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/yourls_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -66,6 +47,8 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
|
|||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/yourls_ynh/tree/testing --debug
|
||||
or
|
||||
ou
|
||||
sudo yunohost app upgrade yourls -u https://github.com/YunoHost-Apps/yourls_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -1,25 +1,26 @@
|
|||
# See here for more informations
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
admin="john"
|
||||
is_public=1
|
||||
password="1Strong-Password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
#upgrade=1 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=anmol@datamol.org
|
||||
Notification=change
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `yourls_options` ( `option_name`, `option_value`) VALUES
|
||||
('active_plugins', 'a:1:{i:0;s:29:"yourls-ldap-plugin/plugin.php";}');
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
SOURCE_URL=https://github.com/YOURLS/YOURLS/archive/1.8.1.zip
|
||||
SOURCE_SUM=c67eb7bf717de677d8a03d8be2cc0a505810252a75bcc00c3d6717c4d0ad7123
|
||||
SOURCE_URL=https://github.com/YOURLS/YOURLS/archive/1.8.2.zip
|
||||
SOURCE_SUM=155e3e223b698bd3d0ab3f90d988b51c74f727fd46db144ca950a693d5dedba6
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
91
conf/config-sample.php
Normal file
91
conf/config-sample.php
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/* This is a sample config file.
|
||||
* Edit this file with your own settings and save it as "config.php"
|
||||
*
|
||||
* IMPORTANT: edit and save this file as plain ASCII text, using a text editor, for instance TextEdit on Mac OS or
|
||||
* Notepad on Windows. Make sure there is no character before the opening <?php at the beginning of this file.
|
||||
*/
|
||||
|
||||
/*
|
||||
** MySQL settings - You can get this info from your web host
|
||||
*/
|
||||
|
||||
/** MySQL database username */
|
||||
define( 'YOURLS_DB_USER', '__DB_USER__' );
|
||||
|
||||
/** MySQL database password */
|
||||
define( 'YOURLS_DB_PASS', '__DB_PWD__' );
|
||||
|
||||
/** The name of the database for YOURLS
|
||||
** Use lower case letters [a-z], digits [0-9] and underscores [_] only */
|
||||
define( 'YOURLS_DB_NAME', '__DB_NAME__' );
|
||||
|
||||
/** MySQL hostname.
|
||||
** If using a non standard port, specify it like 'hostname:port', e.g. 'localhost:9999' or '127.0.0.1:666' */
|
||||
define( 'YOURLS_DB_HOST', 'localhost' );
|
||||
|
||||
/** MySQL tables prefix
|
||||
** YOURLS will create tables using this prefix (eg `yourls_url`, `yourls_options`, ...)
|
||||
** Use lower case letters [a-z], digits [0-9] and underscores [_] only */
|
||||
define( 'YOURLS_DB_PREFIX', 'yourls_' );
|
||||
|
||||
/*
|
||||
** Site options
|
||||
*/
|
||||
|
||||
/** YOURLS installation URL
|
||||
** All lowercase, no trailing slash at the end.
|
||||
** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa)
|
||||
** To use an IDN domain (eg http://héhé.com), write its ascii form here (eg http://xn--hh-bjab.com) */
|
||||
define( 'YOURLS_SITE', 'http://__DOMAIN____PATH__' );
|
||||
|
||||
/** YOURLS language
|
||||
** Change this setting to use a translation file for your language, instead of the default English.
|
||||
** That translation file (a .mo file) must be installed in the user/language directory.
|
||||
** See http://yourls.org/translations for more information */
|
||||
define( 'YOURLS_LANG', '' );
|
||||
|
||||
/** Allow multiple short URLs for a same long URL
|
||||
** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
|
||||
** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
|
||||
define( 'YOURLS_UNIQUE_URLS', true );
|
||||
|
||||
/** Private means the Admin area will be protected with login/pass as defined below.
|
||||
** Set to false for public usage (eg on a restricted intranet or for test setups)
|
||||
** Read http://yourls.org/privatepublic for more details if you're unsure */
|
||||
define( 'YOURLS_PRIVATE', true );
|
||||
|
||||
/** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated
|
||||
** Hint: copy from http://yourls.org/cookie */
|
||||
define( 'YOURLS_COOKIEKEY', '__RANDOM__' );
|
||||
|
||||
/** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
|
||||
** YOURLS will auto encrypt plain text passwords in this file
|
||||
** Read http://yourls.org/userpassword for more information */
|
||||
$yourls_user_passwords = [
|
||||
'__ADMIN__' => '__PASSWORD__',
|
||||
// 'username2' => 'password2',
|
||||
// You can have one or more 'login'=>'password' lines
|
||||
];
|
||||
|
||||
/** URL shortening method: either 36 or 62
|
||||
** 36: generates all lowercase keywords (ie: 13jkm)
|
||||
** 62: generates mixed case keywords (ie: 13jKm or 13JKm)
|
||||
** For more information, see https://yourls.org/urlconvert */
|
||||
define( 'YOURLS_URL_CONVERT', 36 );
|
||||
|
||||
/** Debug mode to output some internal information
|
||||
** Default is false for live site. Enable when coding or before submitting a new issue */
|
||||
define( 'YOURLS_DEBUG', false );
|
||||
|
||||
/**
|
||||
* Reserved keywords (so that generated URLs won't match them)
|
||||
* Define here negative, unwanted or potentially misleading keywords.
|
||||
*/
|
||||
$yourls_reserved_URL = [
|
||||
'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick',
|
||||
];
|
||||
|
||||
/*
|
||||
** Personal settings would go after here.
|
||||
*/
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
/* This is a sample config file.
|
||||
* Edit this file with your own settings and save it as "config.php"
|
||||
*/
|
||||
|
||||
/*
|
||||
** MySQL settings - You can get this info from your web host
|
||||
*/
|
||||
|
||||
/** MySQL database username */
|
||||
define('YOURLS_DB_USER', '__DB_NAME__');
|
||||
|
||||
/** MySQL database password */
|
||||
define('YOURLS_DB_PASS', '__DB_PWD__');
|
||||
|
||||
/** The name of the database for YOURLS */
|
||||
define('YOURLS_DB_NAME', '__DB_NAME__');
|
||||
|
||||
/** MySQL hostname.
|
||||
** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
|
||||
define('YOURLS_DB_HOST', 'localhost');
|
||||
|
||||
/** MySQL tables prefix */
|
||||
define('YOURLS_DB_PREFIX', '__DB_NAME___');
|
||||
|
||||
/*
|
||||
** Site options
|
||||
*/
|
||||
|
||||
/** YOURLS installation URL -- all lowercase and with no trailing slash.
|
||||
** If you define it to "http://site.com", don't use "http://www.site.com" in your browser (and vice-versa) */
|
||||
define('YOURLS_SITE', 'https://__DOMAIN____PATH__');
|
||||
|
||||
/** Timezone GMT offset */
|
||||
define('YOURLS_HOURS_OFFSET', 0);
|
||||
|
||||
/** YOURLS language or "locale".
|
||||
** Change this setting to "localize" YOURLS (use a translation instead of the default English). A corresponding .mo file
|
||||
** must be installed in the user/language directory.
|
||||
** See http://yourls.org/translations for more information */
|
||||
define('YOURLS_LANG', '');
|
||||
|
||||
/** Allow multiple short URLs for a same long URL
|
||||
** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
|
||||
** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
|
||||
define('YOURLS_UNIQUE_URLS', true);
|
||||
|
||||
/** Private means the Admin area will be protected with login/pass as defined below.
|
||||
** Set to false for public usage (eg on a restricted intranet or for test setups)
|
||||
** Read http://yourls.org/privatepublic for more details if you're unsure */
|
||||
define('YOURLS_PRIVATE', false);
|
||||
|
||||
/** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/
|
||||
define('YOURLS_COOKIEKEY', '__RANDOM__');
|
||||
|
||||
/** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
|
||||
** YOURLS will auto encrypt plain text passwords in this file
|
||||
** Read http://yourls.org/userpassword for more information */
|
||||
$yourls_user_passwords = array();
|
||||
|
||||
/** Debug mode to output some internal information
|
||||
** Default is false for live site. Enable when coding or before submitting a new issue */
|
||||
define('YOURLS_DEBUG', false);
|
||||
|
||||
/*
|
||||
** URL Shortening settings
|
||||
*/
|
||||
|
||||
/** URL shortening method: 36 or 62 */
|
||||
define('YOURLS_URL_CONVERT', 36);
|
||||
/*
|
||||
* 36: generates all lowercase keywords (ie: 13jkm)
|
||||
* 62: generates mixed case keywords (ie: 13jKm or 13JKm)
|
||||
* Stick to one setting. It's best not to change after you've started creating links.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reserved keywords (so that generated URLs won't match them)
|
||||
* Define here negative, unwanted or potentially misleading keywords.
|
||||
*/
|
||||
$yourls_reserved_URL = array(
|
||||
'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick', 'gay',
|
||||
);
|
||||
|
||||
/*
|
||||
** Personal settings would go after here.
|
||||
*/
|
||||
|
||||
//define( 'LDAPAUTH_HOST', 'localhost' );
|
||||
//define( 'LDAPAUTH_PORT', '389' );
|
||||
//define( 'LDAPAUTH_BASE', 'dc=yunohost,dc=org' );
|
||||
//define( 'LDAPAUTH_USERNAME_FIELD', 'uid');
|
||||
require_once(dirname(__DIR__) . '/includes/functions-auth.php');
|
|
@ -2,16 +2,13 @@
|
|||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<title>YOURLS</title>
|
||||
<link rel="stylesheet" href="css/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="login">
|
||||
<p><img src="images/yourls-logo.png" alt=""></p>
|
||||
<p><a href="admin">Admin page</a></p>
|
||||
<p><a href="admin">Admin interface</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +1,17 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/;
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
try_files $uri $uri/ __FINALPATH__/yourls-loader.php;
|
||||
|
||||
|
||||
index index.php index.html index.htm;
|
||||
|
||||
try_files $uri $uri/ __PATH__/yourls-loader.php;
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
; Start a new pool named 'www'.
|
||||
; the variable $pool can we used in any directive and will be replaced by the
|
||||
; the variable $pool can be used in any directive and will be replaced by the
|
||||
; pool name ('www' here)
|
||||
[__NAMETOCHANGE__]
|
||||
|
||||
; Per pool prefix
|
||||
; It only applies on the following directives:
|
||||
; - 'access.log'
|
||||
; - 'slowlog'
|
||||
; - 'listen' (unixsocket)
|
||||
; - 'chroot'
|
||||
|
@ -24,17 +25,19 @@ group = __USER__
|
|||
|
||||
; The address on which to accept FastCGI requests.
|
||||
; Valid syntaxes are:
|
||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
|
||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
||||
; a specific port;
|
||||
; 'port' - to listen on a TCP socket to all addresses on a
|
||||
; specific port;
|
||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||
; a specific port;
|
||||
; 'port' - to listen on a TCP socket to all addresses
|
||||
; (IPv6 and IPv4-mapped) on a specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||
|
||||
; Set listen(2) backlog. A value of '-1' means unlimited.
|
||||
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
||||
;listen.backlog = 128
|
||||
; Set listen(2) backlog.
|
||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||
;listen.backlog = 511
|
||||
|
||||
; Set permissions for unix socket, if one is used. In Linux, read/write
|
||||
; permissions must be set in order to allow connections from a web server. Many
|
||||
|
@ -44,8 +47,13 @@ listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
|||
listen.owner = www-data
|
||||
listen.group = www-data
|
||||
;listen.mode = 0660
|
||||
; When POSIX Access Control Lists are supported you can set them using
|
||||
; these options, value is a comma separated list of user/group names.
|
||||
; When set, listen.owner and listen.group are ignored
|
||||
;listen.acl_users =
|
||||
;listen.acl_groups =
|
||||
|
||||
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
|
||||
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
|
||||
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
||||
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
||||
; must be separated by a comma. If this value is left blank, connections will be
|
||||
|
@ -59,7 +67,13 @@ listen.group = www-data
|
|||
; - The pool processes will inherit the master process priority
|
||||
; unless it specified otherwise
|
||||
; Default Value: no set
|
||||
; priority = -19
|
||||
; process.priority = -19
|
||||
|
||||
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
|
||||
; or group is differrent than the master process user. It allows to create process
|
||||
; core dump and ptrace the process for the pool user.
|
||||
; Default Value: no
|
||||
; process.dumpable = yes
|
||||
|
||||
; Choose how the process manager will control the number of child processes.
|
||||
; Possible Values:
|
||||
|
@ -96,7 +110,7 @@ pm = dynamic
|
|||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = 10
|
||||
pm.max_children = 5
|
||||
|
||||
; The number of child processes created on startup.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
|
@ -122,7 +136,7 @@ pm.max_spare_servers = 3
|
|||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||
; Default Value: 0
|
||||
pm.max_requests = 500
|
||||
;pm.max_requests = 500
|
||||
|
||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||
; recognized as a status page. It shows the following informations:
|
||||
|
@ -215,7 +229,7 @@ pm.max_requests = 500
|
|||
; last request memory: 0
|
||||
;
|
||||
; Note: There is a real-time FPM status monitoring sample web page available
|
||||
; It's available in: ${prefix}/share/fpm/status.html
|
||||
; It's available in: /usr/share/php/7.0/fpm/status.html
|
||||
;
|
||||
; Note: The value must start with a leading slash (/). The value can be
|
||||
; anything, but it may not be a good idea to use the .php extension or it
|
||||
|
@ -275,7 +289,7 @@ pm.max_requests = 500
|
|||
; - %{megabytes}M
|
||||
; - %{mega}M
|
||||
; %n: pool name
|
||||
; %o: ouput header
|
||||
; %o: output header
|
||||
; it must be associated with embraces to specify the name of the header:
|
||||
; - %{Content-Type}o
|
||||
; - %{X-Powered-By}o
|
||||
|
@ -291,9 +305,13 @@ pm.max_requests = 500
|
|||
; %t: server time the request was received
|
||||
; it can accept a strftime(3) format:
|
||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||
; %T: time the log has been written (the request has finished)
|
||||
; it can accept a strftime(3) format:
|
||||
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||
; %u: remote user
|
||||
;
|
||||
; Default: "%R - %u %t \"%m %r\" %s"
|
||||
|
@ -302,13 +320,13 @@ pm.max_requests = 500
|
|||
; The log file for slow requests
|
||||
; Default Value: not set
|
||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||
slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log
|
||||
;slowlog = log/$pool.log.slow
|
||||
|
||||
; The timeout for serving a single request after which a PHP backtrace will be
|
||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||
; Default Value: 0
|
||||
request_slowlog_timeout = 5s
|
||||
;request_slowlog_timeout = 0
|
||||
|
||||
; The timeout for serving a single request after which the worker process will
|
||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
||||
|
@ -347,15 +365,24 @@ chdir = __FINALPATH__
|
|||
; Note: on highloaded environement, this can cause some delay in the page
|
||||
; process time (several ms).
|
||||
; Default Value: no
|
||||
catch_workers_output = yes
|
||||
;catch_workers_output = yes
|
||||
|
||||
; Clear environment in FPM workers
|
||||
; Prevents arbitrary environment variables from reaching FPM worker processes
|
||||
; by clearing the environment in workers before env vars specified in this
|
||||
; pool configuration are added.
|
||||
; Setting to "no" will make all environment variables available to PHP code
|
||||
; via getenv(), $_ENV and $_SERVER.
|
||||
; Default Value: yes
|
||||
;clear_env = no
|
||||
|
||||
; Limits the extensions of the main script FPM will allow to parse. This can
|
||||
; prevent configuration mistakes on the web server side. You should only limit
|
||||
; FPM to .php extensions to prevent malicious users to use other extensions to
|
||||
; exectute php code.
|
||||
; execute php code.
|
||||
; Note: set an empty value to allow all extensions.
|
||||
; Default Value: .php
|
||||
;security.limit_extensions = .php .php3 .php4 .php5
|
||||
;security.limit_extensions = .php .php3 .php4 .php5 .php7
|
||||
|
||||
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
||||
; the current environment.
|
||||
|
@ -391,14 +418,13 @@ catch_workers_output = yes
|
|||
;php_admin_flag[log_errors] = on
|
||||
;php_admin_value[memory_limit] = 32M
|
||||
|
||||
|
||||
; Common values to change to increase file upload limit
|
||||
; upload_max_filesize = 50M
|
||||
; post_max_size = 50M
|
||||
; mail.add_x_header = Off
|
||||
; php_admin_value[upload_max_filesize] = 50M
|
||||
; php_admin_value[post_max_size] = 50M
|
||||
; php_admin_flag[mail.add_x_header] = Off
|
||||
|
||||
; Other common parameters
|
||||
; max_execution_time = 600
|
||||
; max_input_time = 300
|
||||
; memory_limit = 256M
|
||||
; short_open_tag = On
|
||||
; php_admin_value[max_execution_time] = 600
|
||||
; php_admin_value[max_input_time] = 300
|
||||
; php_admin_value[memory_limit] = 256M
|
||||
; php_admin_flag[short_open_tag] = On
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import json
|
||||
|
||||
with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile:
|
||||
data = json.load(jsonFile)
|
||||
data["protected_urls"].remove("__DOMAIN____PATH__/admin")
|
||||
|
||||
with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile:
|
||||
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))
|
11
doc/DESCRIPTION.md
Normal file
11
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
YOURLS stands for Your Own URL Shortener. It is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or bitly).
|
||||
|
||||
### YOURLS Features
|
||||
|
||||
- Free and open-source software,
|
||||
- Private (your links only) or Public (everybody can create short links, fine for an intranet),
|
||||
- Terrific Plugin architecture and dozens of plugins to easily implement new features,
|
||||
- Handy bookmarklets to easily shorten and share links,
|
||||
- Awesome stats: historical click reports, referrers tracking, visitors geo-location,
|
||||
- Developer API to integrate YOURLS into other applications,
|
||||
- Sample files to create your own public interface and more !
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
BIN
doc/screenshots/p4.png
Normal file
BIN
doc/screenshots/p4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
|
@ -6,22 +6,28 @@
|
|||
"en": "URL shortening service",
|
||||
"fr": "Service de raccourcisseur d'URL"
|
||||
},
|
||||
"version": "1.8.1~ynh1",
|
||||
"url": "https://github.com/YOURLS/YOURLS",
|
||||
"version": "1.8.2~ynh1",
|
||||
"url": "https://yourls.org/",
|
||||
"license": "MIT",
|
||||
"upstream": {
|
||||
"license": "MIT",
|
||||
"website": "https://yourls.org/",
|
||||
"demo": "https://yourls.org/cookie+",
|
||||
"admindoc": "https://github.com/YOURLS/YOURLS/wiki",
|
||||
"code": "https://github.com/YOURLS/YOURLS"
|
||||
},
|
||||
"maintainer": {
|
||||
"name": "Anmol Sharma",
|
||||
"email": "anmol@datamol.org",
|
||||
"url": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
"email": "anmol@datamol.org"
|
||||
},
|
||||
"previous_maintainers": {
|
||||
"name": "courgette",
|
||||
"email": "courgette@farcie.fr",
|
||||
"url": "http://thomaslebeau.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
|
@ -32,8 +38,7 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "domain.org"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
@ -43,8 +48,16 @@
|
|||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"example": "johndoe"
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
YNH_PHP_VERSION="7.4"
|
||||
|
||||
# dependencies used by the app
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php-pear"
|
||||
pkg_dependencies="php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php-pear"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -63,4 +63,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for YOURLS. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
123
scripts/change_url
Normal file
123
scripts/change_url
Normal file
|
@ -0,0 +1,123 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
random=$(ynh_app_setting_get --app=$app --key=random)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
domain=$new_domain
|
||||
path=$new_path
|
||||
ynh_add_config --template="../conf/config-sample.php" --destination="$final_path/user/config.php"
|
||||
|
||||
chmod 600 "$final_path/user/config.php"
|
||||
chown $app:$app "$final_path/user/config.php"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
102
scripts/install
102
scripts/install
|
@ -26,6 +26,9 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
password="$YNH_APP_ARG_PASSWORD"
|
||||
random=$(ynh_string_random --length=24)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -48,6 +51,22 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
|
|||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=random --value=$random
|
||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -68,82 +87,81 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# copy index file
|
||||
cp ../conf/index.php $final_path/
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
# copy index file
|
||||
cp ../conf/index.php $final_path/
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/config-sample.php" --destination="$final_path/user/config.php"
|
||||
|
||||
chmod 600 "$final_path/user/config.php"
|
||||
chown $app:$app "$final_path/user/config.php"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
||||
cp ../conf/config.php $final_path/user/config.php
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
# Making the app public for curl
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php"
|
||||
# Installation with curl
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=1
|
||||
ynh_local_curl "admin/install.php" "install=dummy"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/user/config.php"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown -R $app: $final_path
|
||||
chmod 600 $final_path/user/config.php
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --time --weight=1
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=3
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
sleep 10
|
||||
|
||||
# Start YOURLS install (database table creation)
|
||||
ynh_local_curl "admin/install.php" "install=dummy"
|
||||
sleep 10
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of YOURLS completed" --last
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
|
@ -31,14 +32,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the protected_urls
|
||||
python3 $final_path/remove_sso_conf.py
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing YOURLS main directory..." --weight=4
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=4
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -59,6 +53,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
|||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -73,4 +75,4 @@ ynh_system_user_delete --username=$app
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of YOURLS completed" --last
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -38,19 +38,25 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -58,21 +64,9 @@ ynh_script_progression --message="Restoring YOURLS main directory..." --weight=3
|
|||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chmod 600 $final_path/user/config.php
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -81,6 +75,16 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=10
|
|||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -104,4 +108,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for YOURLS" --last
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
108
scripts/upgrade
108
scripts/upgrade
|
@ -20,6 +20,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
|
@ -29,6 +30,20 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up YOURLS before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -52,63 +67,49 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up YOURLS before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
if ! ynh_permission_exists --permission="admin"; then
|
||||
# Create the required permissions
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
# Create a temporary directory along with /user/plugin sub directory in it
|
||||
tmpdir="$(mktemp -d)"
|
||||
mkdir -p "$tmpdir/user/"
|
||||
|
||||
# Backup the app files in the temp dir
|
||||
cp -a "$final_path/index.php" "$tmpdir"
|
||||
cp -a "$final_path/.htaccess" "$tmpdir"
|
||||
cp -a "$final_path/user/config.php" "$tmpdir/user"
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/user/config.php"
|
||||
fi
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# Copy the app files from tmp to final_path
|
||||
cp -a "$tmpdir/index.php" "$final_path"
|
||||
cp -a "$tmpdir/.htaccess" "$final_path"
|
||||
cp -a "$tmpdir/user/config.php" "$final_path/user"
|
||||
|
||||
#remove tmp dir
|
||||
ynh_secure_remove "$tmpdir"
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=3
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -116,34 +117,7 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..." --weight=2
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/user/config.php"
|
||||
|
||||
cp ../conf/config.php $final_path/user/config.php
|
||||
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php"
|
||||
ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php"
|
||||
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/user/config.php"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chmod 600 $final_path/user/config.php
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
@ -156,4 +130,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of YOURLS completed" --last
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Reference in a new issue