mirror of
https://github.com/YunoHost/install-app.git
synced 2024-09-03 20:06:19 +02:00
commit
1fef658c3a
5 changed files with 165 additions and 102 deletions
|
@ -114,11 +114,13 @@ img {
|
|||
/* Layout */
|
||||
.overlay {
|
||||
padding: 2%;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.ynh-wrapper {
|
||||
width: 90%;
|
||||
margin: 2% 5%;
|
||||
margin-top: 20px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
|
93
index.php
93
index.php
|
@ -8,40 +8,32 @@ $user_locale = substr(Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']),
|
|||
if (!file_exists("locales/".$user_locale.".json")) { $user_locale = 'en'; }
|
||||
$locale=json_decode(file_get_contents("locales/".$user_locale.".json"), true);
|
||||
|
||||
// Parse the official app list
|
||||
$official_json=file_get_contents("https://app.yunohost.org/official.json");
|
||||
$official=json_decode($official_json, true);
|
||||
// Parse the apps list
|
||||
$apps_list_json=file_get_contents("http://app.yunohost.org/apps.json");
|
||||
$apps_list=json_decode($apps_list_json, true);
|
||||
|
||||
// Check whether the app is official, community, or neither
|
||||
if(array_key_exists($app, $official)) {
|
||||
// The app is in the official list
|
||||
$app_status = 'official'; // The app is in the official list
|
||||
$app_name = $official[$app]['manifest']['name']; // Saves the app name
|
||||
$app_git = $official[$app]['git']['url']; // Saves the git URL
|
||||
$app_state = $official[$app]['state']; // Saves the app state
|
||||
// Check if the app is the apps list
|
||||
if(array_key_exists($app, $apps_list)) {
|
||||
// The app is in the apps list
|
||||
$app_status = $apps_list[$app]['state']; // Saves the app state
|
||||
$app_name = $apps_list[$app]['manifest']['name']; // Saves the app name
|
||||
$app_git = $apps_list[$app]['git']['url']; // Saves the git URL
|
||||
if (array_key_exists("level", $apps_list[$app])) {
|
||||
$app_level = $apps_list[$app]['level'];
|
||||
}
|
||||
else {
|
||||
// Parse the community app list
|
||||
$community_json=file_get_contents("https://app.yunohost.org/community.json");
|
||||
$community=json_decode($community_json, true);
|
||||
|
||||
// Check if the app is community
|
||||
if(array_key_exists($app, $community)) {
|
||||
// The app is in the community list
|
||||
$app_status = 'community'; // The app is in the community list
|
||||
$app_name = $community[$app]['manifest']['name']; // Saves the app name
|
||||
$app_git = $community[$app]['git']['url']; // Saves the git URL
|
||||
$app_state = $community[$app]['state']; // Saves the app state
|
||||
$app_level = 0;
|
||||
$app_status = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// The app is neither in the official, nor in the community list
|
||||
// The app is not in the apps list
|
||||
$app_status = null;
|
||||
$app_name = "";
|
||||
}
|
||||
}
|
||||
|
||||
// If the user submitted his or her server and the app is official, redirects to the server
|
||||
if(isset($_POST['server']) AND !empty($_POST['server']) AND $app_status == 'official') {
|
||||
// If the user submitted his or her server and the app is in apps ist, redirects to the server
|
||||
if(isset($_POST['server']) AND !empty($_POST['server']) AND $app_status == 'working') {
|
||||
$server = rtrim(preg_replace('#^https?://#', '', $_POST['server']),"/");
|
||||
$url = 'https://'.$server.'/yunohost/admin/#/apps/install/'.$app;
|
||||
header('Location: '.$url);
|
||||
|
@ -92,8 +84,15 @@ if(isset($_POST['server']) AND !empty($_POST['server']) AND $app_status == 'offi
|
|||
<div class="ynh-wrapper login">
|
||||
|
||||
<?php
|
||||
// The app is official, display an install form
|
||||
if($app_status == 'official') {
|
||||
// The app is in apps list, display an install form
|
||||
if($app_status == 'working') {
|
||||
if($app_level <= 4) {
|
||||
?>
|
||||
<div class="wrapper messages warning">
|
||||
<p><?php echo $locale['app_state_warning']; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<form class="login-form" name="input" action="" method="post">
|
||||
<div class="form-group">
|
||||
|
@ -104,45 +103,7 @@ if($app_status == 'official') {
|
|||
</form>
|
||||
<?php
|
||||
}
|
||||
// The app is community, display a specific form and a warning
|
||||
else if($app_status == 'community') {
|
||||
?>
|
||||
<div class="wrapper messages warning">
|
||||
<p><?php echo str_replace(["{app_name}", "{app_state}"], [$app_name, $locale[$app_state]], $locale['community_warning']); ?></p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// If the user submitted his or her server and the app is community, redirects to the server
|
||||
if(isset($_POST['server']) AND !empty($_POST['server']) AND $app_status == 'community') {
|
||||
$server = rtrim(preg_replace('#^https?://#', '', $_POST['server']),"/");
|
||||
$url = 'https://'.$server.'/yunohost/admin/#/apps/install';
|
||||
?>
|
||||
<form class="login-form" name="input" action="<?php echo $url; ?>" method="get">
|
||||
<p style="text-align:center;color:white;"><?php echo $locale['community_instructions']; ?></p>
|
||||
<div class="form-group">
|
||||
<label class="icon icon-pencil" for="git"><span class="element-invisible"><?php echo $app_git; ?></span></label>
|
||||
<input id="git" type="text" name="git" value="<?php echo $app_git; ?>" class="form-text" readonly onClick="this.select();">
|
||||
</div>
|
||||
<input type="submit" value="<?php echo $locale['community_redirect']; ?>" class="btn classic-btn large-btn">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
// Display the server form
|
||||
?>
|
||||
|
||||
<form class="login-form" name="input" action="" method="post">
|
||||
<div class="form-group">
|
||||
<label class="icon icon-connexion" for="server"><span class="element-invisible"><?php echo $locale['server_link']; ?></span></label>
|
||||
<input id="server" type="text" name="server" placeholder="<?php echo $locale['server_link']; ?>" class="form-text" autofocus required>
|
||||
</div>
|
||||
<input type="submit" value="<?php echo str_replace("{app_name}", $app_name, $locale['install_button']); ?> (community)" class="btn classic-btn large-btn">
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
// The app is neither official, nor community
|
||||
// The app is not in the apps list
|
||||
else {
|
||||
?>
|
||||
<div class="wrapper messages danger">
|
||||
|
|
104
install-with-yunohost.svg
Normal file
104
install-with-yunohost.svg
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="40.567963mm"
|
||||
height="9.3789921mm"
|
||||
viewBox="0 0 40.567963 9.3789921"
|
||||
version="1.1"
|
||||
id="svg20371"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
sodipodi:docname="dessin.svg">
|
||||
<defs
|
||||
id="defs20365" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6"
|
||||
inkscape:cx="32.113688"
|
||||
inkscape:cy="-9.7018851"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata20368">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-85.549354,-144.14383)">
|
||||
<rect
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
id="rect20433"
|
||||
width="37.750374"
|
||||
height="6.8508182"
|
||||
x="87.061256"
|
||||
y="145.20735" />
|
||||
<g
|
||||
id="g20412">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path20289"
|
||||
d="m 86.008486,153.04777 c -0.612176,-0.61218 -0.612176,-7.81669 0,-8.42887 0.633415,-0.63342 39.016284,-0.63342 39.649694,0 0.61218,0.61218 0.61218,7.81669 0,8.42887 -0.63341,0.63341 -39.016279,0.63341 -39.649694,0 z m 27.100614,-2.83582 c 0.2877,-0.0752 0.68898,0.0789 0.94665,0.36364 0.61498,0.67954 0.91438,0.40112 0.63104,-0.58683 -0.12963,-0.452 -0.16254,-1.35553 -0.0731,-2.00785 0.1461,-1.06594 0.11166,-1.17636 -0.34013,-1.09056 -0.38455,0.073 -0.522,0.36304 -0.58485,1.23398 -0.0996,1.38046 -0.94993,1.54139 -0.96655,0.18293 -0.007,-0.53391 -0.15857,-0.81621 -0.47265,-0.87753 -0.37033,-0.0723 -0.46302,0.0959 -0.46302,0.84003 0,0.63547 -0.17048,1.04986 -0.53776,1.30711 -0.52966,0.37099 -0.52468,0.3915 0.33073,1.36135 0.86849,0.98469 0.86849,0.98469 0.94939,0.19451 0.0521,-0.5088 0.25872,-0.83669 0.58028,-0.92078 z m -13.131068,0.53961 c 0.08774,-0.32742 0.161168,-0.90815 0.163148,-1.29052 0.002,-0.38236 0.18221,-0.84342 0.40049,-1.02458 0.21828,-0.18116 0.39688,-0.48637 0.39688,-0.67824 0,-0.56204 -0.5773,-0.75747 -0.84174,-0.28495 -0.343514,0.61382 -1.010348,0.53955 -1.010348,-0.11254 0,-0.74032 -0.4972,-1.62109 -0.807025,-1.42961 -0.528901,0.32688 -0.01301,2.76992 0.584911,2.76992 0.122162,0 0.222114,0.40698 0.222114,0.90441 0,1.60972 0.570715,2.34338 0.89157,1.14611 z m 3.326598,-0.31245 c 0.414,-0.49884 0.70995,-3.32557 0.34817,-3.32557 -0.1486,0 -0.40727,0.54441 -0.57481,1.2098 -0.33677,1.33743 -0.85413,1.45613 -1.00289,0.23009 -0.1693,-1.39528 -0.40264,-1.63508 -0.62873,-0.64614 -0.4715,2.06241 0.80474,3.80124 1.85826,2.53182 z m 2.00444,-0.0697 c 0.30746,-0.42048 0.37003,-0.42067 1.00756,-0.003 0.37386,0.24496 0.72761,0.3574 0.78611,0.24988 0.27407,-0.50366 0.0343,-4.39108 -0.27722,-4.49495 -0.23567,-0.0786 -0.33072,0.2763 -0.33072,1.2347 0,1.58411 -0.26091,1.70199 -0.88242,0.39867 -0.64723,-1.35725 -0.99181,-1.02574 -1.06591,1.02548 -0.0776,2.14867 0.0932,2.50462 0.7626,1.58916 z m 11.92788,-0.0187 c 1.08702,-0.72583 1.05554,-2.56111 -0.0511,-2.98187 -0.89927,-0.3419 -1.05804,-0.32539 -1.54398,0.16055 -1.17284,1.17284 0.26234,3.71125 1.59513,2.82132 z m -1.12831,-1.27051 c -0.22052,-0.57466 0.33933,-1.11509 0.74003,-0.71437 0.33868,0.33867 0.12887,1.12903 -0.29971,1.12903 -0.15466,0 -0.3528,-0.18659 -0.44032,-0.41466 z m 4.39597,1.0919 c 0.17396,-0.20961 0.27783,-0.65316 0.23084,-0.98567 -0.0566,-0.40026 0.0649,-0.63451 0.35962,-0.69318 0.33328,-0.0663 0.46619,0.13137 0.52916,0.78723 0.0542,0.56476 0.22506,0.87584 0.48098,0.87584 0.29391,0 0.37574,-0.24519 0.31541,-0.94509 -0.0756,-0.87712 -0.004,-0.97991 0.99149,-1.42894 1.16788,-0.52664 1.09193,-1.19784 -0.13553,-1.19784 -0.33875,0 -0.72522,-0.19531 -0.8588,-0.43403 -0.29601,-0.52893 -0.84174,-0.24998 -0.84174,0.43026 0,0.39109 -1.24149,1.32668 -1.76044,1.32668 -0.24732,0 -0.0508,-0.76328 0.21978,-0.85346 0.44308,-0.14769 0.0128,-0.73404 -0.53871,-0.73404 -0.47253,0 -1.09562,0.47632 -1.09562,0.83755 0,0.1114 0.35993,0.57075 0.79985,1.02079 0.83586,0.85507 0.81833,1.4556 -0.036,1.23219 -0.5745,-0.15023 -0.60214,-0.0729 -0.22541,0.63103 0.32286,0.60329 1.11778,0.66966 1.56509,0.13068 z m -10.62314,-0.46557 c 0.52852,-0.52853 0.39665,-2.70385 -0.19646,-3.24061 -0.49341,-0.44652 -0.54101,-0.43806 -1.19063,0.21155 -1.17753,1.17753 -0.84442,3.34656 0.51396,3.34656 0.30559,0 0.6985,-0.14288 0.87313,-0.3175 z m -1.27001,-1.38668 c 0,-0.75815 0.49376,-1.16247 0.80487,-0.65908 0.23926,0.38713 -0.14729,1.30493 -0.54959,1.30493 -0.1404,0 -0.25528,-0.29063 -0.25528,-0.64585 z"
|
||||
style="fill:#000000;stroke-width:0.26458332" />
|
||||
<text
|
||||
transform="scale(0.96418468,1.0371457)"
|
||||
id="text20110-6-9-6-2"
|
||||
y="142.75237"
|
||||
x="95.386917"
|
||||
style="font-style:normal;font-weight:normal;font-size:8.51359749px;line-height:11.69999987%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:2.83786559px;line-height:11.69999987%;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
y="142.75237"
|
||||
x="95.386917"
|
||||
id="tspan20108-7-3-1-28"
|
||||
sodipodi:role="line">Install</tspan><tspan
|
||||
id="tspan20116-5-6-8-9"
|
||||
style="font-size:2.83786559px;line-height:11.69999987%;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
y="144.89079"
|
||||
x="95.386917"
|
||||
sodipodi:role="line" /><tspan
|
||||
id="tspan20118-3-0-7-73"
|
||||
style="font-size:2.83786559px;line-height:11.69999987%;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
y="145.88687"
|
||||
x="95.386917"
|
||||
sodipodi:role="line">with</tspan><tspan
|
||||
id="tspan20112-5-6-9-6"
|
||||
style="font-size:2.83786559px;line-height:11.69999987%;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
y="148.0253"
|
||||
x="95.386917"
|
||||
sodipodi:role="line" /><tspan
|
||||
id="tspan20114-6-2-2-1"
|
||||
style="font-size:2.83786559px;line-height:11.69999987%;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.07;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
y="149.02139"
|
||||
x="95.386917"
|
||||
sodipodi:role="line" /></text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.1 KiB |
|
@ -2,14 +2,12 @@
|
|||
"title": "Install {app_name} with YunoHost",
|
||||
"server_link": "Link to your YunoHost server",
|
||||
"install_button": "Install {app_name}",
|
||||
"community_warning": "<strong>WARNING</strong>: {app_name} is <strong>NOT officially supported</strong> by the YunoHost team yet. Install it <strong>at your own risk</strong>. The community maintainer has described this app to be in a {app_state} state.",
|
||||
"community_instructions": "Copy the following link. You will then be redirected to your server apps installation page in which you will need to paste this link.",
|
||||
"community_redirect": "Go to your server",
|
||||
"app_notfound": "This application is neither officially nor community maintained.",
|
||||
"working": "working",
|
||||
"inprogress": "in progress",
|
||||
"notworking": "not working",
|
||||
"noserver": "No YunoHost server yet?",
|
||||
"yunohost": "YunoHost is a server operating system aiming to make self-hosting accessible to everyone.",
|
||||
"discover": "Discover YunoHost"
|
||||
"discover": "Click here to discover YunoHost",
|
||||
"app_state_warning": "<strong>WARNING</strong>: This app is bad-quality for now. Installation could maybe work, but it may lack important features like backup/restore, and/or it uses deprecated practices that may cause issues on your server. Please be careful."
|
||||
}
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
"title": "Installer {app_name} avec YunoHost",
|
||||
"server_link": "Lien vers votre serveur YunoHost",
|
||||
"install_button": "Installer {app_name}",
|
||||
"community_warning": "<strong>ATTENTION</strong> : {app_name} <strong>N'EST PAS officiellement prise en charge</strong> pour le moment par l'équipe YunoHost. Installez cette application <strong>à vos risques et périls</strong>. Le mainteneur de cette application la décrit comme étant dans un état {app_state}.",
|
||||
"community_instructions": "Merci de copier le lien suivant. Vous serez ensuite redirigé vers la page d'installation d'applications de votre serveur dans laquelle vous devrez coller ce lien.",
|
||||
"community_redirect": "Accéder au serveur",
|
||||
"app_notfound": "Cette application n'est maintenue ni officiellemment, ni par la communauté.",
|
||||
"working": "fonctionnel",
|
||||
"inprogress": "en cours de développement",
|
||||
"notworking": "non fonctionnel",
|
||||
"noserver": "Pas encore de serveur YunoHost ?",
|
||||
"yunohost": "YunoHost est un outil qui vous permet d’installer et d’utiliser facilement votre propre serveur.",
|
||||
"discover": "Découvrez YunoHost"
|
||||
"discover": "Cliquez ici pour découvrir YunoHost",
|
||||
"app_state_warning": "<strong>ATTENTION</strong>: Cette application est pour le moment de mauvaise qualité. L'installation va peut-être fonctionner, mais certaines fonctionnalités importantes telles que la sauvegarde/restauration peuvent être manquante, et/ou l'application ne respecte pas les bonnes pratiques ce qui peut créer des problèmes sur votre serveur. Soyez prudent."
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue