mirror of
https://github.com/YunoHost-Apps/cops_ynh.git
synced 2024-09-03 18:25:57 +02:00
Update of manifest.json to request further parameters
This commit is contained in:
parent
4d2ddaedbc
commit
6ad5fbe2a5
7 changed files with 139 additions and 8 deletions
23
conf/config_local.php
Normal file
23
conf/config_local.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
if (!isset($config))
|
||||
$config = array();
|
||||
|
||||
/*
|
||||
* The directory containing calibre's metadata.db file, with sub-directories
|
||||
* containing all the formats.
|
||||
* BEWARE : it has to end with a /
|
||||
*/
|
||||
$config['calibre_directory'] = 'CALIBRETOCHANGE';
|
||||
|
||||
/*
|
||||
* Catalog's title
|
||||
*/
|
||||
$config['cops_title_default'] = "COPS";
|
||||
|
||||
/*
|
||||
* use URL rewriting for downloading of ebook in HTML catalog
|
||||
* See README for more information
|
||||
* 1 : enable
|
||||
* 0 : disable
|
||||
*/
|
||||
$config['cops_use_url_rewriting'] = "0";
|
|
@ -41,6 +41,25 @@
|
|||
"example": "/eBooks",
|
||||
"default": "/eBooks"
|
||||
},
|
||||
{
|
||||
"name": "runninguser",
|
||||
"ask": {
|
||||
"en": "Under which system user should COPS run ?",
|
||||
"fr": "Sous quel utilisateur systeme COPS doit-il fonctionner ?"
|
||||
},
|
||||
"choices": ["owncloud", "nextcloud", "www-data"],
|
||||
"default": "owncloud"
|
||||
},
|
||||
{
|
||||
"name": "calibrepath",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Indicate the location of Calibre library. It MUST end with a / and DON'T store it in your /var/www/cops !!",
|
||||
"fr": "Indiquez le chemin de votre bibliotheque Calibre. Cela DOIT se terminer par un / et ne la mettez pas dans /var/www/cops !!!"
|
||||
},
|
||||
"example": "/home/yunohost.app/owncloud/data/johndoe/files/eBooks/",
|
||||
"default": "/home/yunohost.app/owncloud/data/johndoe/files/eBooks/"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"ask": {
|
||||
|
|
|
@ -15,7 +15,6 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
is_public=$(ynh_app_setting_get $app is_public)
|
||||
finalnginxconf=$(ynh_app_setting_get $app finalnginxconf)
|
||||
finalphpconf=$(ynh_app_setting_get $app finalphpconf)
|
||||
runninguser=$(ynh_app_setting_get $app runninguser)
|
||||
|
||||
# Backup sources & data
|
||||
# Note: the last argument is where to save this path, see the restore script.
|
||||
|
|
|
@ -15,7 +15,8 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
runninguser="owncloud"
|
||||
runninguser=$YNH_APP_ARG_RUNNINGUSER
|
||||
calibrepath=$YNH_APP_ARG_CALIBREPATH
|
||||
|
||||
# We check variables are not empty
|
||||
CHECK_VAR "$app" "app name not set"
|
||||
|
@ -31,10 +32,11 @@ CHECK_FINALPATH
|
|||
final_path=/var/www/$app
|
||||
|
||||
# Define variables and Save app settings
|
||||
ynh_app_setting_set "$app" runninguser "$runninguser"
|
||||
ynh_app_setting_set "$app" domain "$domain"
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
ynh_app_setting_set "$app" runninguser "$runninguser"
|
||||
ynh_app_setting_set "$app" calibrepath "$calibrepath"
|
||||
|
||||
finalnginxconf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
ynh_app_setting_set "$app" finalnginxconf "$finalnginxconf"
|
||||
|
@ -49,13 +51,13 @@ sudo apt-get install --quiet --assume-yes php5-gd php5-sqlite php5-json php5-int
|
|||
#sudo rm -rf $final_path
|
||||
sudo mkdir -p $final_path
|
||||
|
||||
# Site adjustments
|
||||
sudo cp ../conf/config_local.php ../sources/
|
||||
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../sources/config_local.php
|
||||
|
||||
# Base site
|
||||
sudo cp -a ../sources/* $final_path/
|
||||
|
||||
# Site adjustments
|
||||
#sed -i "s@DOMAINTOCHANGE@$domain@g" ../sources/index.html
|
||||
#sed -i "s@SITETOCHANGE@$sitename@g" ../sources/index.html
|
||||
|
||||
# Set permissions
|
||||
sudo chmod 775 -R $final_path
|
||||
sudo chown -hR $runninguser:$runninguser $final_path
|
||||
|
|
|
@ -22,7 +22,6 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
sitename=$(ynh_app_setting_get $app sitename)
|
||||
finalnginxconf=$(ynh_app_setting_get $app finalnginxconf)
|
||||
finalphpconf=$(ynh_app_setting_get $app finalphpconf)
|
||||
runninguser=$(ynh_app_setting_get $app runninguser)
|
||||
|
||||
# Suppression du dossier de la webapp
|
||||
sudo rm -rf $final_path
|
||||
|
|
|
@ -23,6 +23,9 @@ sitename=$(ynh_app_setting_get $app sitename)
|
|||
finalnginxconf=$(ynh_app_setting_get $app finalnginxconf)
|
||||
finalphpconf=$(ynh_app_setting_get $app finalphpconf)
|
||||
runninguser=$(ynh_app_setting_get $app runninguser)
|
||||
calibrepath=$(ynh_app_setting_get $app calibrepath)
|
||||
|
||||
|
||||
|
||||
# We install dependencies
|
||||
sudo apt-get install --quiet --assume-yes php5-gd php5-sqlite php5-json php5-intl
|
||||
|
@ -46,6 +49,10 @@ sudo chmod 644 $finalphpconf
|
|||
sudo rm -rf $final_path
|
||||
sudo mkdir -p $final_path
|
||||
|
||||
# Site adjustments
|
||||
sudo cp ../conf/config_local.php ../sources/
|
||||
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../sources/config_local.php
|
||||
|
||||
# Base site
|
||||
sudo cp -a ../sources/* $final_path/
|
||||
|
||||
|
|
82
sources/.htaccess
Normal file
82
sources/.htaccess
Normal file
|
@ -0,0 +1,82 @@
|
|||
DirectoryIndex index.php
|
||||
|
||||
<IfModule mod_xsendfile.c>
|
||||
<Files fetch.php>
|
||||
XSendFile on
|
||||
</Files>
|
||||
</IfModule>
|
||||
|
||||
###########################################
|
||||
# If the notation above don't work, you can try that one
|
||||
# Disclaimer : I'm no apache expert it can be bad security wise :(
|
||||
###########################################
|
||||
#XSendFile On
|
||||
#XSendFileAllowAbove on
|
||||
|
||||
###########################################
|
||||
# On WAMP one user had to add this line in his httpd.conf
|
||||
# None of the above was working
|
||||
###########################################
|
||||
#XSendFilePath <YourCalibrePath>
|
||||
|
||||
###########################################
|
||||
# If you want to use user based configuration with
|
||||
# apache 2.4 + php-fpm enable this
|
||||
# https://github.com/seblucas/cops/issues/213
|
||||
###########################################
|
||||
#SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]
|
||||
RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L]
|
||||
RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L]
|
||||
RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L]
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive on
|
||||
|
||||
# Data
|
||||
ExpiresByType text/xml "access plus 0 seconds"
|
||||
ExpiresByType application/xml "access plus 0 seconds"
|
||||
ExpiresByType application/json "access plus 0 seconds"
|
||||
ExpiresByType application/xhtml+xml "access plus 0 seconds"
|
||||
|
||||
# Favicon (cannot be renamed)
|
||||
ExpiresByType image/x-icon "access plus 1 week"
|
||||
|
||||
# Media: images
|
||||
ExpiresByType image/png "access plus 1 month"
|
||||
ExpiresByType image/jpg "access plus 1 month"
|
||||
ExpiresByType image/jpeg "access plus 1 month"
|
||||
|
||||
# Webfonts
|
||||
ExpiresByType font/truetype "access plus 1 month"
|
||||
ExpiresByType font/opentype "access plus 1 month"
|
||||
ExpiresByType application/x-font-woff "access plus 1 month"
|
||||
ExpiresByType image/svg+xml "access plus 1 month"
|
||||
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
||||
|
||||
# CSS and JavaScript
|
||||
ExpiresByType text/css "access plus 1 year"
|
||||
ExpiresByType application/javascript "access plus 1 year"
|
||||
ExpiresByType text/javascript "access plus 1 year"
|
||||
</IfModule>
|
||||
|
||||
###########################################
|
||||
# Uncomment if you wish to protect access with a password
|
||||
###########################################
|
||||
# If your covers and books are not available as soon as you protect it
|
||||
# You can try replacing the FilesMatch directive by this one
|
||||
# <FilesMatch "(index|feed)\.php">
|
||||
# it helps for Sony PRS-TX and Aldiko, but beware fetch.php can be accessed
|
||||
# without authentication (see $config ['cops_fetch_protect'] for a workaround).
|
||||
###########################################
|
||||
#<FilesMatch "\.php$">
|
||||
#AuthUserFile /path/to/file
|
||||
#AuthGroupFile /dev/null
|
||||
#AuthName "Acces securise"
|
||||
#AuthType Basic
|
||||
#Require valid-user
|
||||
#</FilesMatch>
|
Loading…
Reference in a new issue