From eb67a192a17a7642ff98d34e3ef66154fd0824ee Mon Sep 17 00:00:00 2001 From: opi Date: Thu, 4 Feb 2016 14:43:48 +0100 Subject: [PATCH] [fix] Use real json boolean value for default key. #141 --- src/dist/js/script.min.js | 2 +- src/js/yunohost/controllers/apps.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dist/js/script.min.js b/src/dist/js/script.min.js index d5d092c6..5607ced5 100644 --- a/src/dist/js/script.min.js +++ b/src/dist/js/script.min.js @@ -13,7 +13,7 @@ if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(t){"use strict !function(){var e=Sammy("#main",function(e){e.bind("run",function(){$("#slider-container").width(2*$("#slider").width()+"px"),$(window).resize(function(){$("#slideBack").css("display","none"),$("#slideTo").css("display","none"),$("#slider-container").width(2*$("#slider").width()+"px").removeClass("move").css("margin-left","0px")});var e=$("#flashMessage");$("#toggle-btn",e).click(function(n){e.toggleClass("open")}),$("#clear-btn",e).click(function(n){e.removeClass("open").find(".messages").html(""),$("#slider").removeClass("with-flashMessage")})}),e.use("Handlebars","ms"),Handlebars.registerHelper("ucwords",function(e){return(e+"").replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(e){return e.toUpperCase()})}),Handlebars.registerHelper("humanSize",function(e){var n=["Bytes","KB","MB","GB","TB"];if(0===e)return"n/a";var a=parseInt(Math.floor(Math.log(e)/Math.log(1024)));return Math.round(e/Math.pow(1024,a),2)+" "+n[[a]]}),Handlebars.registerHelper("humanTime",function(e){return Math.round(e)+"s"}),Handlebars.registerHelper("bitRate",function(e,n){var a=["b","Kb","Mb","Gb","Tb"];if(0===n)return"n/a";var r=e/n*8,t=parseInt(Math.floor(Math.log(r)/Math.log(1024)));return Math.round(r/Math.pow(1024,t),2)+" "+a[[t]]+"/s"}),Handlebars.registerHelper("t",function(e){var n=y18n.t(e,Array.prototype.slice.call(arguments,1));return new Handlebars.SafeString(n)});var n;n=Sammy.Store.isAvailable("local")?"local":Sammy.Store.isAvailable("session")?"session":Sammy.Store.isAvailable("cookie")?"cookie":"memory",e.store=new Sammy.Store({name:"storage",type:n}),e.loaded=!1,e.isInstalledTry=3,e.notFound=function(){window.location="#/"}});$.getJSON("locales/en.json",function(e){y18n.translations.en=e,y18n.translateInlineHTML()}),window.navigator&&window.navigator.language&&(y18n.locale=window.navigator.language.substr(0,2),"en"!==y18n.locale&&$.getJSON("locales/"+y18n.locale+".json",function(e){y18n.translations[y18n.locale]=e,y18n.translateInlineHTML()})),$(document).ready(function(){e.run("#/")})}(); !function(){var e=Sammy.apps["#main"],n=e.store;e.helpers({serialize:function(e){var n=[];for(var o in e)e.hasOwnProperty(o)&&n.push(encodeURIComponent(o)+"="+encodeURIComponent(e[o]));return n.join("&")},flash:function(e,o){n.get("flash")||n.set("flash",!0),$("#slider").addClass("with-flashMessage"),"info"===e&&"+"===o.charAt(0)&&(e="log"),$("#flashMessage .messages").prepend('

'+o+"

")},checkInstall:function(e){domain=window.location.hostname,$.ajax({dataType:"json",url:"https://"+domain+"/yunohost/api/installed",timeout:3e3}).success(function(n){e(n.installed)}).fail(function(){e(void 0)})},api:function(e,o,t,a,s){c=this,call=function(e,o,t,a){t="undefined"!=typeof t?t:"GET",a="undefined"!=typeof a?a:{},window.navigator&&window.navigator.language&&"undefined"==typeof a.locale&&(a.locale=y18n.locale||window.navigator.language.substr(0,2));var s=a;if("/postinstall"===e){var i=!1;setInterval(function(){i=!0},1500)}loaded=!1,0===$("div.loader").length&&$("#main").append('
'),jQuery.ajax({url:"https://"+n.get("url")+e,type:t,crossdomain:!0,data:a,traditional:!0,dataType:"json"}).always(function(e,n,o){}).done(function(e){e=e||{},o(e)}).fail(function(t){if(200==t.status)o({});else if(401==t.status)"/login"===e?c.flash("fail",y18n.t("wrong_password")):(c.flash("fail",y18n.t("unauthorized")),c.redirect("#/login"));else if("undefined"!=typeof t.responseJSON)c.flash("fail",t.responseJSON.error);else if("undefined"!=typeof t.statusText&&"/postinstall"!==e){var a=t.status+" "+t.statusText;"undefined"!=typeof t.responseText&&(a+=" - "+t.responseText),c.flash("fail",y18n.t("api_not_responding",[a]))}else"/postinstall"===e?i?(interval=window.location.hostname===s.domain?2e4:5e3,checkInstall=setInterval(function(){c.checkInstall(function(e){(e||"undefined"==typeof e)&&(c.flash("success",y18n.t("installation_complete")),clearInterval(checkInstall),window.location.href="https://"+window.location.hostname+"/yunohost/admin/")})},interval)):c.flash("fail",y18n.t("error_occured")):c.flash("fail",y18n.t("error_server"));"/postinstall"!==e&&(n.clear("slide"),c.view(n.get("path-1"),null,null,!1))})},s="undefined"!=typeof s?s:!0,s?(ws=new WebSocket("wss://"+n.get("url")+"/messages"),ws.onmessage=function(e){$.each($.parseJSON(e.data),function(e,n){c.flash(e,n)})},ws.onerror=ws.onopen,ws.onclose=function(){},ws.onopen=call(e,o,t,a)):call(e,o,t,a)},view:function(e,o,t,a){if(t="undefined"!=typeof t?t:function(){},rendered=this.render("views/"+e+".ms",o),a="undefined"!=typeof a?a:!0,loaded=!0,$("div.loader").remove(),$("#modal").modal("hide"),a){var s=function(){rendered.swap(function(){$(".slide, .btn-breadcrumb a:not(:last-child)").on("click",function(){$(this).addClass("active"),$(this).hasClass("back")||$(this).parent(".btn-breadcrumb").length?n.set("slide","back"):n.set("slide","to")}),t(),$("html, body").scrollTop(0),setTimeout(function(){$("body").resize()},210)})};blockSize=$("#slider").width(),"back"==n.get("slide")?(n.clear("slide"),$("#slideBack").css("display","none"),$("#slider-container").removeClass("move").css("margin-left","-"+blockSize+"px"),$("#slideTo").show().html($("#main").html()),s(),$("#slider-container").addClass("move").css("margin-left","0px")):"to"==n.get("slide")?(n.clear("slide"),$("#slideTo").css("display","none"),$("#slider-container").removeClass("move").css("margin-left","-"+blockSize+"px"),$("#slider-container").removeClass("move").css("margin-left","0px"),$("#slideBack").show().html($("#main").html()),s(),$("#slider-container").addClass("move").css("margin-left","-"+blockSize+"px")):s()}else rendered.swap(function(){t(),$("html, body").scrollTop(0),$("body").resize()})},confirm:function(e,n,o,t){return o="undefined"!=typeof o?o:function(){},t="undefined"!=typeof t?t:function(){},box=$("#modal"),"string"==typeof e&&e.length?$(".title",box).html(e):box.addClass("no-title"),$(".content",box).html(n),$("footer button",box).click(function(e){e.preventDefault(),$("#modal footer button").unbind("click"),box.removeClass("no-title").modal("hide"),"confirm"==$(this).data("action")?o():t()}),box.modal("show")},arraySortById:function(e){e.sort(function(e,n){return e.id>n.id?1:e.id"+y18n.t("manage_domains")+""),("admin"==s.name||"user"==data.manifest.arguments.install[a].type)&&(data.manifest.arguments.install[a].choices=[],$.each(e.users,function(s,e){data.manifest.arguments.install[a].choices.push({value:s,label:e.fullname+" ("+e.mail+")",selected:!1})}),data.manifest.arguments.install[a].help=""+y18n.t("manage_users")+""),"app"==data.manifest.arguments.install[a].type&&(data.manifest.arguments.install[a].choices=[],$.each(e.apps,function(s,e){data.manifest.arguments.install[a].choices.push({value:e.id,label:e.name,selected:!1})}),data.manifest.arguments.install[a].help=""+y18n.t("manage_apps")+""),"boolean"==data.manifest.arguments.install[a].type&&(data.manifest.arguments.install[a].inputType="checkbox","undefined"!=typeof data.manifest.arguments.install[a]["default"]&&("True"==data.manifest.arguments.install[a]["default"]||"1"==data.manifest.arguments.install[a]["default"])&&(data.manifest.arguments.install[a].attributes='checked="checked"'),data.manifest.arguments.install[a]["default"]=1),("password"==s.name||"password"==data.manifest.arguments.install[a].type)&&(data.manifest.arguments.install[a].inputType="password"),data.manifest.arguments.install[a].label="undefined"!=typeof data.manifest.arguments.install[a].ask[y18n.locale]?data.manifest.arguments.install[a].ask[y18n.locale]:data.manifest.arguments.install[a].ask.en}),data.description="undefined"!=typeof data.manifest.description[y18n.locale]?data.manifest.description[y18n.locale]:data.manifest.description.en,data.manifest.multi_instance="true"==data.manifest.multi_instance?y18n.t("yes"):y18n.t("no"),c.view("app/app_install",data)}),a.get("#/apps/install/:app",function(a){a.api("/apps?raw",function(s){a.appInstallForm(a.params.app,s[a.params.app].manifest,a.params)})}),a.post("#/apps",function(a){"/"!==a.params.path||confirm(y18n.t("confirm_install_domain_root",[a.params.domain]))?(params={label:a.params.label,app:a.params.app},delete a.params.label,delete a.params.app,params.args=a.serialize(a.params.toHash()),""===params.args&&delete params.args,a.api("/apps",function(){a.redirect("#/apps")},"POST",params)):(a.flash("warning",y18n.t("app_install_cancel")),s.clear("slide"),a.redirect("#/apps/install"))}),a.post("#/apps/install/custom",function(a){params={label:a.params.label,app:a.params.url},delete a.params.label,delete a.params.url,a.confirm(y18n.t("applications"),y18n.t("confirm_install_custom_app"),function(){params.app=params.app.replace(/\/?$/,"/"),jQuery.ajax({url:params.app.replace("github.com","raw.githubusercontent.com")+"master/manifest.json",type:"GET"}).done(function(s){s=jQuery.parseJSON(s)||{},a.appInstallForm(params.app,s,a.params)}).fail(function(e){a.flash("fail",y18n.t("app_install_custom_no_manifest")),s.clear("slide"),a.redirect("#/apps/install")})},function(){a.flash("warning",y18n.t("app_install_cancel")),s.clear("slide"),a.redirect("#/apps/install")})}),a.get("#/apps/:app/uninstall",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_uninstall",[a.params.app]),function(){a.api("/apps/"+a.params.app,function(){a.redirect("#/apps")},"DELETE")},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)})}),a.get("#/apps/:app/access",function(a){a.api("/apps/"+a.params.app+"?raw",function(s){a.api("/users",function(e){"undefined"!=typeof s.settings.allowed_users?0===s.settings.allowed_users.length?s.settings.allowed_users=[]:s.settings.allowed_users=s.settings.allowed_users.split(","):(s.settings.allowed_users=[],s.settings.allow_everyone=!0),s.users=[],$.each(e.users,function(a,e){-1===s.settings.allowed_users.indexOf(a)?s.users.push({value:a,label:e.fullname+" ("+e.mail+")"}):s.settings.allowed_users[s.settings.allowed_users.indexOf(a)]={username:a,fullname:e.fullname,mail:e.mail}}),a.view("app/app_access",s)})})}),a.get("#/apps/:app/access/remove",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_remove_all",[a.params.app]),function(){params={apps:a.params.app,users:[]},a.api("/access?"+a.serialize(params),function(e){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"DELETE",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/access/remove/:user",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_remove_user",[a.params.app,a.params.user]),function(){params={apps:a.params.app,users:a.params.user},a.api("/access?"+a.serialize(params),function(e){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"DELETE",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/access/add",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_add",[a.params.app]),function(){params={apps:a.params.app,users:null},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"PUT",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.post("#/apps/:app/access/add",function(a){params={users:a.params.user,apps:a.params.app},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"PUT",params)}),a.get("#/apps/:app/access/clear",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_clear",[a.params.app]),function(){params={apps:a.params.app},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"POST",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/default",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_app_default"),function(){a.api("/apps/"+a.params.app+"/default",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)},"PUT")},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)})})}(); +!function(){var a=Sammy.apps["#main"],s=a.store;a.get("#/apps",function(a){a.api("/apps",function(s){data2={apps:[],installed_apps:!0},$.each(s.apps,function(a,s){s.installed&&data2.apps.push(s)}),a.arraySortById(data2.apps),a.view("app/app_list",data2)})}),a.get("#/apps/install",function(a){a.api("/apps",function(s){a.api("/apps?raw",function(e){data2={apps:[],installed_apps:!1},$.each(s.apps,function(a,s){s.installed&&"true"!=e[s.id].manifest.multi_instance||s.id.match(/__[0-9]{1,5}$/)||(s.install_link=!0,data2.apps.push(s))}),a.arraySortById(data2.apps),a.view("app/app_list",data2)})})}),a.get("#/apps/refresh",function(a){a.api("/appslists",function(s){a.redirect("#/apps/install")},"PUT")}),a.get("#/apps/:app",function(a){a.api("/apps/"+a.params.app+"?raw",function(s){s.settings.allowed_users=s.settings.allowed_users?s.settings.allowed_users.replace(",",", ")+".":y18n.t("everyone_has_access"),s.description="undefined"!=typeof s.manifest.description[y18n.locale]?s.manifest.description[y18n.locale]:s.manifest.description.en,s.manifest.multi_instance="true"==s.manifest.multi_instance?y18n.t("yes"):y18n.t("no");var e=new Date(1e3*s.settings.install_time);s.install_time=e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear(),a.view("app/app_info",s)})}),a.get("#/apps/:app/debug",function(a){a.api("/apps/"+a.params.app+"/debug",function(s){a.view("app/app_debug",s)})}),a.get("#/apps/install/custom",function(a){a.redirect("#/apps/install")}),a.helper("appInstallForm",function(a,s,e){data={id:a,manifest:s},"undefined"!=typeof data.manifest.arguments.install&&$.each(data.manifest.arguments.install,function(a,s){data.manifest.arguments.install[a].type="undefined"!=typeof s.type?s.type:"string",data.manifest.arguments.install[a].inputType="text",data.manifest.arguments.install[a].required="undefined"!=typeof s.optional&&"true"==s.optional?"":"required",data.manifest.arguments.install[a].attributes="","undefined"!=typeof data.manifest.arguments.install[a].choices&&$.each(data.manifest.arguments.install[a].choices,function(s,e){data.manifest.arguments.install[a].choices[s]={value:e,label:e,selected:e==data.manifest.arguments.install[a]["default"]?!0:!1}}),("domain"==s.name||"domain"==data.manifest.arguments.install[a].type)&&(data.manifest.arguments.install[a].choices=[],$.each(e.domains,function(s,e){data.manifest.arguments.install[a].choices.push({value:e,label:e,selected:!1})}),data.manifest.arguments.install[a].help=""+y18n.t("manage_domains")+""),("admin"==s.name||"user"==data.manifest.arguments.install[a].type)&&(data.manifest.arguments.install[a].choices=[],$.each(e.users,function(s,e){data.manifest.arguments.install[a].choices.push({value:s,label:e.fullname+" ("+e.mail+")",selected:!1})}),data.manifest.arguments.install[a].help=""+y18n.t("manage_users")+""),"app"==data.manifest.arguments.install[a].type&&(data.manifest.arguments.install[a].choices=[],$.each(e.apps,function(s,e){data.manifest.arguments.install[a].choices.push({value:e.id,label:e.name,selected:!1})}),data.manifest.arguments.install[a].help=""+y18n.t("manage_apps")+""),"boolean"==data.manifest.arguments.install[a].type&&(data.manifest.arguments.install[a].inputType="checkbox","undefined"!=typeof data.manifest.arguments.install[a]["default"]&&1==data.manifest.arguments.install[a]["default"]&&(data.manifest.arguments.install[a].attributes='checked="checked"'),data.manifest.arguments.install[a]["default"]=1),("password"==s.name||"password"==data.manifest.arguments.install[a].type)&&(data.manifest.arguments.install[a].inputType="password"),data.manifest.arguments.install[a].label="undefined"!=typeof data.manifest.arguments.install[a].ask[y18n.locale]?data.manifest.arguments.install[a].ask[y18n.locale]:data.manifest.arguments.install[a].ask.en}),data.description="undefined"!=typeof data.manifest.description[y18n.locale]?data.manifest.description[y18n.locale]:data.manifest.description.en,data.manifest.multi_instance="true"==data.manifest.multi_instance?y18n.t("yes"):y18n.t("no"),c.view("app/app_install",data)}),a.get("#/apps/install/:app",function(a){a.api("/apps?raw",function(s){a.appInstallForm(a.params.app,s[a.params.app].manifest,a.params)})}),a.post("#/apps",function(a){"/"!==a.params.path||confirm(y18n.t("confirm_install_domain_root",[a.params.domain]))?(params={label:a.params.label,app:a.params.app},delete a.params.label,delete a.params.app,params.args=a.serialize(a.params.toHash()),""===params.args&&delete params.args,a.api("/apps",function(){a.redirect("#/apps")},"POST",params)):(a.flash("warning",y18n.t("app_install_cancel")),s.clear("slide"),a.redirect("#/apps/install"))}),a.post("#/apps/install/custom",function(a){params={label:a.params.label,app:a.params.url},delete a.params.label,delete a.params.url,a.confirm(y18n.t("applications"),y18n.t("confirm_install_custom_app"),function(){params.app=params.app.replace(/\/?$/,"/"),jQuery.ajax({url:params.app.replace("github.com","raw.githubusercontent.com")+"master/manifest.json",type:"GET"}).done(function(s){s=jQuery.parseJSON(s)||{},a.appInstallForm(params.app,s,a.params)}).fail(function(e){a.flash("fail",y18n.t("app_install_custom_no_manifest")),s.clear("slide"),a.redirect("#/apps/install")})},function(){a.flash("warning",y18n.t("app_install_cancel")),s.clear("slide"),a.redirect("#/apps/install")})}),a.get("#/apps/:app/uninstall",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_uninstall",[a.params.app]),function(){a.api("/apps/"+a.params.app,function(){a.redirect("#/apps")},"DELETE")},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)})}),a.get("#/apps/:app/access",function(a){a.api("/apps/"+a.params.app+"?raw",function(s){a.api("/users",function(e){"undefined"!=typeof s.settings.allowed_users?0===s.settings.allowed_users.length?s.settings.allowed_users=[]:s.settings.allowed_users=s.settings.allowed_users.split(","):(s.settings.allowed_users=[],s.settings.allow_everyone=!0),s.users=[],$.each(e.users,function(a,e){-1===s.settings.allowed_users.indexOf(a)?s.users.push({value:a,label:e.fullname+" ("+e.mail+")"}):s.settings.allowed_users[s.settings.allowed_users.indexOf(a)]={username:a,fullname:e.fullname,mail:e.mail}}),a.view("app/app_access",s)})})}),a.get("#/apps/:app/access/remove",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_remove_all",[a.params.app]),function(){params={apps:a.params.app,users:[]},a.api("/access?"+a.serialize(params),function(e){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"DELETE",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/access/remove/:user",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_remove_user",[a.params.app,a.params.user]),function(){params={apps:a.params.app,users:a.params.user},a.api("/access?"+a.serialize(params),function(e){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"DELETE",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/access/add",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_add",[a.params.app]),function(){params={apps:a.params.app,users:null},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"PUT",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.post("#/apps/:app/access/add",function(a){params={users:a.params.user,apps:a.params.app},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"PUT",params)}),a.get("#/apps/:app/access/clear",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_access_clear",[a.params.app]),function(){params={apps:a.params.app},a.api("/access",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")},"POST",params)},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app+"/access")})}),a.get("#/apps/:app/default",function(a){a.confirm(y18n.t("applications"),y18n.t("confirm_app_default"),function(){a.api("/apps/"+a.params.app+"/default",function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)},"PUT")},function(){s.clear("slide"),a.redirect("#/apps/"+a.params.app)})})}(); !function(){var a=Sammy.apps["#main"],e=a.store;a.get("#/backup",function(a){var e=[],r={id:"local",name:y18n.t("local_archives"),uri:"/home/yunohost.backup/"};e.push(r),a.view("backup/backup",{storages:e})}),a.get("#/storages/create",function(a){a.view("backup/storage_create",{})}),a.post("#/storages",function(a){e.clear("slide"),a.redirect("#/storages")}),a.get("#/backup/:storage/create",function(a){var e=[];e.storage={id:a.params.storage,name:y18n.t("local_archives")},a.api("/hooks/backup",function(r){e.hooks=a.groupHooks(r.hooks),e.apps={},a.api("/apps?raw",function(r){$.each(r,function(a,r){r.installed&&(e.apps[a]={id:a,name:r.manifest.name})}),a.view("backup/backup_create",e)})})}),a.post("#/backup/:storage",function(a){var r=a.ungroupHooks(a.params.hooks,a.params.apps);a.api("/backup",function(){e.clear("slide"),a.redirect("#/backup/"+a.params.storage)},"POST",r)}),a.post("#/backup/:storage/:archive/restore",function(a){a.confirm(y18n.t("backup"),y18n.t("confirm_restore",[a.params.archive]),$.proxy(function(a){var r=a.ungroupHooks(a.params.hooks,a.params.apps);r.force="",a.api("/backup/restore/"+a.params.archive,function(r){e.clear("slide"),a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)},"POST",r)},this,a),function(){e.clear("slide"),a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)})}),a.get("#/backup/:storage/:archive/delete",function(a){a.confirm(y18n.t("backup"),y18n.t("confirm_delete",[a.params.archive]),function(){a.api("/backup/archives/"+a.params.archive,function(e){a.redirect("#/backup/"+a.params.storage)},"DELETE")},function(){e.clear("slide"),a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)})}),a.get("#/backup/:storage/:archive/download",function(a){a.api("/backup/"+a.params.archive+"/download",function(e){a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)},"GET")}),a.get("#/backup/:storage/:archive/copy",function(a){e.clear("slide"),a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)}),a.get("#/backup/:storage/:archive/upload",function(a){e.clear("slide"),a.redirect("#/backup/"+a.params.storage+"/"+a.params.archive)}),a.get("#/backup/:storage/:archive",function(a){a.api("/backup/archives/"+a.params.archive+"?with_details",function(e){e.storage={id:a.params.storage,name:y18n.t("local_archives")},e.other_storages=[],e.name=a.params.archive,e.hooks=a.groupHooks(Object.keys(e.hooks)),e.items=e.hooks!={}||e.apps!=[],a.view("backup/backup_info",e)})}),a.get("#/backup/:storage",function(a){a.api("/backup/archives?with_info",function(e){e.storage={id:"local",name:y18n.t("local_archives")},e.archives2=[],$.each(e.archives,function(a,r){r.name=a,e.archives2.unshift(r)}),e.archives=e.archives2,a.view("backup/backup_list",e)})})}(); !function(){var n=Sammy.apps["#main"],a=n.store;n.get("#/domains",function(n){n.api("/domains",function(a){n.api("/domains/main",function(i){domains=[],$.each(a.domains,function(n,a){domains.push({url:a,main:a==i.current_main_domain?!0:!1})}),main_domain_form=domains.length>1?!0:!1,domains.sort(function(n,a){return-2*n.main+1}),n.view("domain/domain_list",{domains:domains,main_domain_form:main_domain_form})},"PUT")})}),n.get("#/domains/add",function(n){$.get("https://dyndns.yunohost.org/domains",function(){}).done(function(a){n.params.ddomains=a.map(function(n){return"."+n})}).fail(function(){n.params.ddomains=[".nohost.me",".noho.st"]}).always(function(){data={ddomains:n.params.ddomains,domains:n.params.domains,allowDyndnsDomain:!0};var a=data.ddomains.join("|");$.each(data.domains,function(n,i){i.search(a)>0&&(data.allowDyndnsDomain=!1)}),n.view("domain/domain_add",data)})}),n.post("#/domains/add",function(n){""===n.params.domain?(""===n.params.ddomain&&(n.flash("fail",y18n.t("error_select_domain")),a.clear("slide"),n.redirect("#/domains/add")),params={domain:n.params.ddomain+n.params["ddomain-ext"]},endurl="dyndns"):(params={domain:n.params.domain},endurl=""),n.api("/domains?"+endurl,function(a){n.redirect("#/domains")},"POST",params)}),n.get("#/domains/:domain/delete",function(n){n.confirm(y18n.t("domains"),y18n.t("confirm_delete",[n.params.domain]),function(){n.api("/domains/"+n.params.domain,function(i){a.clear("slide"),n.redirect("#/domains")},"DELETE")},function(){a.clear("slide"),n.redirect("#/domains")})}),n.post("#/domains",function(n){""===n.params.domain?(n.flash("fail",y18n.t("error_select_domain")),a.clear("slide"),n.redirect("#/domains")):n.confirm(y18n.t("domains"),y18n.t("confirm_change_maindomain"),function(){params={new_domain:n.params.domain},n.api("/domains/main",function(i){a.clear("slide"),n.redirect("#/domains")},"PUT",params),refreshDomain=window.setTimeout(function(){a.clear("slide"),n.redirect("#/domains")},15e3)},function(){a.clear("slide"),n.redirect("#/domains")})})}(); !function(){var o=Sammy.apps["#main"],a=o.store;o.get("#/tools/firewall",function(o){o.api("/firewall?raw",function(a){var t={ports:{},upnp:!1};$.each(["ipv4","ipv6","uPnP"],function(o,r){$.each(["TCP","UDP"],function(o,n){t.ports[n]=t.ports[n]||{},$.each(a[r][n],function(o,a){t.ports[n][a]=t.ports[n][a]||{},t.ports[n][a][r]=!0})})}),t.upnp=a.uPnP.enabled,o.view("tools/tools_firewall",t)})}),o.get("#/tools/firewall/upnp/:action",function(o){o.confirm(y18n.t("firewall"),y18n.t("confirm_upnp_action",[y18n.t(o.params.action)]),function(){params={action:o.params.action},o.api("/firewall/upnp",function(t){a.clear("slide"),o.redirect("#/tools/firewall")},"GET",params)},function(){a.clear("slide"),o.redirect("#/tools/firewall")})}),o.helper("togglePort",function(o,t,r,n){var l=null,i=[],e=this;switch((o!=parseInt(o)||0>o||o>65535)&&(e.flash("fail",y18n.t("unknown_argument",[o])),a.clear("slide"),e.redirect("#/tools/firewall")),r){case"ipv4":i="ipv4_only";break;case"ipv6":i="ipv6_only"}switch(t){case"udp":t="UDP";break;case"both":t="Both";break;default:t="TCP"}switch(n){case"open":l="POST";break;case"close":l="DELETE";break;default:e.flash("fail",y18n.t("unknown_action",[n])),a.clear("slide"),e.redirect("#/tools/firewall")}if(null!==l&&null!==t&&null!==o){var c={port:o,protocol:t};e.api("/firewall/port?"+i,function(o){a.clear("slide"),e.redirect("#/tools/firewall")},l,c)}else a.clear("slide"),e.redirect("#/tools/firewall")}),o.get("#/tools/firewall/port/:port/:protocol/:connection/:action",function(o){o.confirm(y18n.t("firewall"),y18n.t("confirm_firewall",[y18n.t(o.params.action),o.params.port,y18n.t(o.params.protocol),y18n.t(o.params.connection)]),function(){o.togglePort(o.params.port,o.params.protocol,o.params.connection,o.params.action)},function(){a.clear("slide"),o.redirect("#/tools/firewall")})}),o.post("#/tools/firewall/port",function(o){o.confirm(y18n.t("firewall"),y18n.t("confirm_firewall",[y18n.t(o.params.action),o.params.port,y18n.t(o.params.protocol),y18n.t(o.params.connection)]),function(){o.togglePort(o.params.port,o.params.protocol,o.params.connection,o.params.action)},function(){a.clear("slide"),o.redirect("#/tools/firewall")})})}(); diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 8a1ba8dd..695d4705 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -162,7 +162,7 @@ // Checked or not ? if (typeof data.manifest.arguments.install[k].default !== 'undefined') { - if (data.manifest.arguments.install[k].default == "True" || data.manifest.arguments.install[k].default == "1") { + if (data.manifest.arguments.install[k].default == true) { data.manifest.arguments.install[k].attributes = 'checked="checked"'; } }