1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00

install sso and importer for yeswiki

This commit is contained in:
mrflos 2024-05-24 15:36:21 +02:00
parent 7fe1ad9a6f
commit 8398ac71d6
5 changed files with 106 additions and 59 deletions

View file

@ -307,6 +307,54 @@ section h2 {
#yw-topnav .navbar-nav > li > a {
font-family: var(--main-title-fontfamily);
}
@media (max-width: 800px) {
#yw-topnav .navbar-header .navbar-brand {
padding: 0;
}
#yw-topnav .btn .fa {
font-size: 1rem !important;
}
#yw-topnav .yw-topnav-fast-access .btn.btn-default, #yw-topnav .btn.btn-menu.btn-default, #yw-topnav .yw-topnav-fast-access .btn.btn-default:hover, #yw-topnav .yw-topnav-fast-access .btn.btn-default:focus {
font-size: 0;
padding: 0;
}
#yw-topnav .yw-topnav-fast-access .btn {
margin-left: 0;
}
#yw-topnav .yw-topnav-fast-access .btn i {
font-size: 1rem;
}
#yw-topnav .btn.btn-default {
min-height: 2rem;
min-width: 2rem;
display: flex;
align-content: center;
align-items: center;
text-align: center;
justify-content: center;
}
#yw-topnav .container {
padding: 0 .25rem;
}
.yw-topnav-fast-access {
min-width: 150px;
min-height: 70px;
display: flex;
align-items: center;
justify-content: center;
}
#yw-topnav .navbar-brand img {
max-height: 2.5rem;
width: auto;
margin-left: 0;
margin-top: .2rem;
}
}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('PageFooter', now(), '{{section class=\"text-center\"}}
👉 [[https://projetclic.cc CLIC]] 👈
@ -332,9 +380,9 @@ Double cliquer sur ce texte pour éditer cette colonne.
\"\"\"\"', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('PageMenuHaut', now(), ' - [[?PagePrincipale#Cooperer Coopérer]]
- [[?PagePrincipale#S-informer S\'informer]]
- [[?PagePrincipale#Echanger Echanger]]', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('PageMenuHaut', now(), ' - [Accueil]({{rootpage}})
- [Services](Services)
- [Ressources](Ressource)', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('{{rootPage}}', now(), '
{{section bgcolor=\"var(--primary-color)\" class=\"shape-rounded\" pattern=\"border-solid\" }}=====Bienvenue=====
Vous êtes sur un espace auto-hébergé de partage de ressource et d\'outils numériques coopératifs sous license libre.
@ -342,26 +390,6 @@ Tout est à disposition pour que vous puissiez consulter cela localement, chez v
Ces services ont é mis en place par {{button class=\"btn-primary new-window\" link=\"https://colibris-outilslibres.org/\" nobtn=\"1\" text=\"Colibris\" title=\"mouvement Colibris\" }}, {{button class=\"new-window\" link=\"https://distrilab.fr\" nobtn=\"1\" text=\"le DistriLab\" title=\"le DistriLab\"}}, {{button class=\"new-window\" link=\"https://www.ritimo.org/\" nobtn=\"1\" text=\"Ritimo\" title=\"Ritimo\"}}, {{button class=\"new-window\" link=\"https://yeswiki.net\" nobtn=\"1\" text=\"YesWiki\" title=\"YesWiki\"}}, {{button class=\"new-window\" link=\"https://yunohost.org\" nobtn=\"1\" text=\"YUNoHost\" title=\"YUNoHost\"}}, {{button class=\"new-window\" link=\"https://framasoft.org\" nobtn=\"1\" text=\"Framasoft\" title=\"Framasoft\"}},
{{end elem=\"section\"}}
\"\"<div id=\"Cooperer\"></div>\"\"
=====Coopérer=====
\"\"<div id=\"S-informer\"></div>\"\"
=====S\'informer=====
\"\"<div id=\"Echanger\"></div>\"\"
=====Echanger=====
', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('PageRapideHaut', now(), '{{moteurrecherche template=\"moteurrecherche_button.tpl.html\"}}
{{buttondropdown icon=\"cog\" caret=\"0\" title=\"Gestion du site\"}}
@ -377,6 +405,9 @@ Ces services ont été mis en place par {{button class=\"btn-primary new-window\
{{login template=\"modal.tpl.html\"}}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('PageTitre', now(), '![logo CLIC](files/logoclic.png)', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('ParametresUtilisateur', now(), '{{UserSettings}}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('Ressources', now(), '# Ressources
{{bazarliste id=\"4\" template=\"card\" displayfields=\"visual=imagebf_image,title=bf_titre,subtitle=bf_description,footer=checkboxListeType\" nbcol=\"1\" style=\"horizontal\" }}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('RechercheTexte', now(), '{{newtextsearch}}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('ReglesDeFormatage', now(), 'N\'hésitez pas à personnaliser cette page d\'aide (code utile, astuce...) en cliquant sur [ReglesDeFormatage](ReglesDeFormatage/edit){.newtab}
{#Placez votre aide personnalisée entre ici#}
@ -450,6 +481,9 @@ Il est possible de copier des icônes dans des sites sources puis de les coller
('SaisirRessource', now(), '{{nav links=\"FacetteRessource, SaisirRessource\" titles=\"Les ressources, Déposer une ressource\"}}
{{bazar voirmenu=\"0\" vue=\"saisir\" id=\"4\"}}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('Services', now(), '# Services libres
{{bazarliste id=\"5\" template=\"card\" displayfields=\"visual=imagebf_image,title=bf_titre,subtitle=bf_description\" groups=\"listeListeVisibilite\" imgstyle=\"contain\" nbcol=\"3\" }}', '', '{{WikiName}}', '{{WikiName}}', 'Y', 'page', ''),
('TableauDeBord', now(), '# Tableau de bord
{{accordion }}

View file

@ -78,13 +78,13 @@ url = "https://github.com/YesWiki/yeswiki/archive/refs/tags/v4.4.4.tar.gz"
sha256 = "0b4e97bdd01ab627a8a9cb5bf652708e34a9322509cb8fcb9db0fb12b6a3e6ef"
autoupdate.strategy = "latest_github_tag"
[resources.sources.loginldap]
url = "https://repository.yeswiki.net/doryphore/extension-loginldap-1.0.0.zip"
sha256 = "28c9489e4fb0c83e0e775d80a1d07cbc3fbf56d42ab550b45571455f1a6ce9f9"
[resources.sources.yunohostplugin]
url = "https://repository.yeswiki.net/doryphore/extension-yunohost-1.0.0.zip"
sha256 = ""
sha256 = "60032781016d2bdcecce4ad5ae91e72407e64a994f63661e27a7a935ba52d50b"
[resources.sources.importerplugin]
url = "https://repository.yeswiki.net/doryphore/extension-importer-1.0.0.zip"
sha256 = "7c5e730b4724a991ae64fdf457b9ec6d0416621f7fecb38e5b7a73e36d22eb00"
[resources.sources.ferme]
url = "https://repository.yeswiki.net/doryphore/extension-ferme-1.1.8.zip"

View file

@ -72,29 +72,47 @@ fi
# (kind of strange, should be doable using the previous curl?)
ynh_replace_string --match_string="'allow_raw_html' => false," --replace_string="'allow_raw_html' => true," --target_file="$install_dir/wakka.config.php"
#=================================================
# DOWNLOAD AND CONFIGURE IMPORTER PLUGIN
#=================================================
ynh_script_progression --message="Configure importer plugin" --weight=1
# Download yeswiki plugin from yeswiki repository
mkdir -p "$install_dir/tools/importer"
ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin"
#=================================================
# DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Configure yunohost plugin" --weight=2
# Download yeswiki plugin from yeswiki repository
mkdir -p "$install_dir/tools/yunohost"
ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostplugin"
# Add config at the end of wakka.config.php
ynh_replace_string --match_string=");" --replace_string=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' => 'fr',\n'importer' => 'YunohostCLIApp', // importer class name (without Importer suffix)\n],\n],\n);" --target_file="$install_dir/wakka.config.php"
# Ensure that scripts are executable
chmod +x $install_dir/tools/yunohost/private/scripts/*.sh
# Add app user in sudoers to authorize to launch yunohost cli commands without password
ynh_add_jinja_config --template="sudoers" --destination="/etc/sudoers.d/$app"
# At last, run the YunoHost app importer
ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2
pushd $install_dir
ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli
popd
if [ "${authprovider}" = "Yunohost SSO" ]; then
#=================================================
# DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN
# CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Configure yunohost plugin" --weight=2
# Download yeswiki plugin from yeswiki repository
mkdir -p "$install_dir/tools/yunohost"
ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostplugin"
ynh_script_progression --message="Enable YunoHost SSO" --weight=1
# Add config at the end of wakka.config.php
ynh_replace_string --match_string=");" --replace_string=" 'enable_yunohost_sso' => true,\n);" --target_file="$install_dir/wakka.config.php"
# ToDo : verify if we need to chmod yunohost-user-info.sh to make it executable
# ToDo : update the CSS for mobile devices
# ToDo : update CLIC yeswiki model to display the yunohost apps
# ToDo : run the yunohost app importer during CLIC install
ynh_add_jinja_config --template="sudoers" --destination="/etc/sudoers.d/$app"
fi
if [ "${wikimodel}" = "CLIC" ]; then

View file

@ -20,6 +20,8 @@ ynh_remove_nginx_config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
# TODO: remove /etc/sudoers/$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -25,7 +25,7 @@ then
# Download, check integrity, uncompress and patch the source from app.src
# TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep
noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})"
noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,importer,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})"
ferme_instances="$(cd $install_dir; for p in $(ls -- */wakka.config.php 2>/dev/null); do dirname "$p"; done)"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances"
@ -56,23 +56,16 @@ ynh_script_progression --message="Installing composer dependencies..."
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
#=================================================
# DOWNLOAD AND CONFIGURE LDAP PLUGIN
# DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Upgrading LDAP plugin..." --weight=3
ynh_script_progression --message="Upgrading Yunohost plugin..." --weight=3
# Download LDAP plugin from yeswiki repository
ynh_secure_remove "$install_dir/tools/loginldap"
mkdir -p "$install_dir/tools/loginldap"
ynh_setup_source --dest_dir="$install_dir/tools/loginldap" --source_id="loginldap"
# Download yunohost plugin from yeswiki repository
ynh_secure_remove "$install_dir/tools/yunohost"
mkdir -p "$install_dir/tools/yunohost"
ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostplugin"
if ! grep -q "ldap_host" "$install_dir/wakka.config.php"
then
# Add LDAP config at the end of wakka.config.php
ynh_replace_string --match_string=");" --replace_string=" 'ldap_host' => '127.0.0.1',\n);" --target_file="$install_dir/wakka.config.php"
ynh_replace_string --match_string=");" --replace_string=" 'ldap_port' => '389',\n);" --target_file="$install_dir/wakka.config.php"
ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);" --target_file="$install_dir/wakka.config.php"
fi
#=================================================
# SECURE FILES AND DIRECTORIES