From 33733d0b328ca9af3647fb29f4f89f91875f773a Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 2 Mar 2016 09:17:01 +0100 Subject: [PATCH] [fix] Call redirect() on path, not view(). Fix #205 --- src/dist/js/script.min.js | 4 ++-- src/js/yunohost/helpers.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dist/js/script.min.js b/src/dist/js/script.min.js index cbf1cb49..f2e61fb6 100644 --- a/src/dist/js/script.min.js +++ b/src/dist/js/script.min.js @@ -11,13 +11,13 @@ this.inlineStack=[],this.compileChildren(t,e);var n,r=t.opcodes;this.i=0;for(var if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]}}t.fn.emulateTransitionEnd=function(e){var i=!1,o=this;t(this).one(t.support.transition.end,function(){i=!0});var n=function(){i||t(o).trigger(t.support.transition.end)};return setTimeout(n,e),this},t(function(){t.support.transition=e()})}(window.jQuery),+function(t){"use strict";var e='[data-dismiss="alert"]',i=function(i){t(i).on("click",e,this.close)};i.prototype.close=function(e){function i(){s.trigger("closed.bs.alert").remove()}var o=t(this),n=o.attr("data-target");n||(n=o.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,""));var s=t(n);e&&e.preventDefault(),s.length||(s=o.hasClass("alert")?o:o.parent()),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one(t.support.transition.end,i).emulateTransitionEnd(150):i())};var o=t.fn.alert;t.fn.alert=function(e){return this.each(function(){var o=t(this),n=o.data("bs.alert");n||o.data("bs.alert",n=new i(this)),"string"==typeof e&&n[e].call(o)})},t.fn.alert.Constructor=i,t.fn.alert.noConflict=function(){return t.fn.alert=o,this},t(document).on("click.bs.alert.data-api",e,i.prototype.close)}(window.jQuery),+function(t){"use strict";var e=function(i,o){this.$element=t(i),this.options=t.extend({},e.DEFAULTS,o)};e.DEFAULTS={loadingText:"loading..."},e.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",n.resetText||i.data("resetText",i[o]()),i[o](n[t]||this.options[t]),setTimeout(function(){"loadingText"==t?i.addClass(e).attr(e,e):i.removeClass(e).removeAttr(e)},0)},e.prototype.toggle=function(){var t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var e=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===e.prop("type")&&t.find(".active").removeClass("active")}this.$element.toggleClass("active")};var i=t.fn.button;t.fn.button=function(i){return this.each(function(){var o=t(this),n=o.data("bs.button"),s="object"==typeof i&&i;n||o.data("bs.button",n=new e(this,s)),"toggle"==i?n.toggle():i&&n.setState(i)})},t.fn.button.Constructor=e,t.fn.button.noConflict=function(){return t.fn.button=i,this},t(document).on("click.bs.button.data-api","[data-toggle^=button]",function(e){var i=t(e.target);i.hasClass("btn")||(i=i.closest(".btn")),i.button("toggle"),e.preventDefault()})}(window.jQuery),+function(t){"use strict";var e=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",t.proxy(this.pause,this)).on("mouseleave",t.proxy(this.cycle,this))};e.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},e.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},e.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},e.prototype.to=function(e){var i=this,o=this.getActiveIndex();return e>this.$items.length-1||0>e?void 0:this.sliding?this.$element.one("slid",function(){i.to(e)}):o==e?this.pause().cycle():this.slide(e>o?"next":"prev",t(this.$items[e]))},e.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition.end&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},e.prototype.next=function(){return this.sliding?void 0:this.slide("next")},e.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},e.prototype.slide=function(e,i){var o=this.$element.find(".item.active"),n=i||o[e](),s=this.interval,a="next"==e?"left":"right",r="next"==e?"first":"last",l=this;if(!n.length){if(!this.options.wrap)return;n=this.$element.find(".item")[r]()}this.sliding=!0,s&&this.pause();var h=t.Event("slide.bs.carousel",{relatedTarget:n[0],direction:a});if(!n.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var e=t(l.$indicators.children()[l.getActiveIndex()]);e&&e.addClass("active")})),t.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(h),h.isDefaultPrevented())return;n.addClass(e),n[0].offsetWidth,o.addClass(a),n.addClass(a),o.one(t.support.transition.end,function(){n.removeClass([e,a].join(" ")).addClass("active"),o.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(h),h.isDefaultPrevented())return;o.removeClass("active"),n.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var i=t.fn.carousel;t.fn.carousel=function(i){return this.each(function(){var o=t(this),n=o.data("bs.carousel"),s=t.extend({},e.DEFAULTS,o.data(),"object"==typeof i&&i),a="string"==typeof i?i:s.slide;n||o.data("bs.carousel",n=new e(this,s)),"number"==typeof i?n.to(i):a?n[a]():s.interval&&n.pause().cycle()})},t.fn.carousel.Constructor=e,t.fn.carousel.noConflict=function(){return t.fn.carousel=i,this},t(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(e){var i,o=t(this),n=t(o.attr("data-target")||(i=o.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"")),s=t.extend({},n.data(),o.data()),a=o.attr("data-slide-to");a&&(s.interval=!1),n.carousel(s),(a=o.attr("data-slide-to"))&&n.data("bs.carousel").to(a),e.preventDefault()}),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var e=t(this);e.carousel(e.data())})})}(window.jQuery),+function(t){"use strict";var e=function(i,o){this.$element=t(i),this.options=t.extend({},e.DEFAULTS,o),this.transitioning=null,this.options.parent&&(this.$parent=t(this.options.parent)),this.options.toggle&&this.toggle()};e.DEFAULTS={toggle:!0},e.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},e.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e=t.Event("show.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.$parent&&this.$parent.find("> .panel > .in");if(i&&i.length){var o=i.data("bs.collapse");if(o&&o.transitioning)return;i.collapse("hide"),o||i.data("bs.collapse",null)}var n=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[n](0),this.transitioning=1;var s=function(){this.$element.removeClass("collapsing").addClass("in")[n]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return s.call(this);var a=t.camelCase(["scroll",n].join("-"));this.$element.one(t.support.transition.end,t.proxy(s,this)).emulateTransitionEnd(350)[n](this.$element[0][a])}}},e.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.dimension();this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var o=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return t.support.transition?void this.$element[i](0).one(t.support.transition.end,t.proxy(o,this)).emulateTransitionEnd(350):o.call(this)}}},e.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var i=t.fn.collapse;t.fn.collapse=function(i){return this.each(function(){var o=t(this),n=o.data("bs.collapse"),s=t.extend({},e.DEFAULTS,o.data(),"object"==typeof i&&i);n||o.data("bs.collapse",n=new e(this,s)),"string"==typeof i&&n[i]()})},t.fn.collapse.Constructor=e,t.fn.collapse.noConflict=function(){return t.fn.collapse=i,this},t(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(e){var i,o=t(this),n=o.attr("data-target")||e.preventDefault()||(i=o.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,""),s=t(n),a=s.data("bs.collapse"),r=a?"toggle":o.data(),l=o.attr("data-parent"),h=l&&t(l);a&&a.transitioning||(h&&h.find('[data-toggle=collapse][data-parent="'+l+'"]').not(o).addClass("collapsed"),o[s.hasClass("in")?"addClass":"removeClass"]("collapsed")),s.collapse(r)})}(window.jQuery),+function(t){"use strict";function e(){t(o).remove(),t(n).each(function(e){var o=i(t(this));o.hasClass("open")&&(o.trigger(e=t.Event("hide.bs.dropdown")),e.isDefaultPrevented()||o.removeClass("open").trigger("hidden.bs.dropdown"))})}function i(e){var i=e.attr("data-target");i||(i=e.attr("href"),i=i&&/#/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var o=i&&t(i);return o&&o.length?o:e.parent()}var o=".dropdown-backdrop",n="[data-toggle=dropdown]",s=function(e){t(e).on("click.bs.dropdown",this.toggle)};s.prototype.toggle=function(o){var n=t(this);if(!n.is(".disabled, :disabled")){var s=i(n),a=s.hasClass("open");if(e(),!a){if("ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t(''}),e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),e.prototype.constructor=e,e.prototype.getDefaults=function(){return e.DEFAULTS},e.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content")[this.options.html?"html":"text"](i),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},e.prototype.hasContent=function(){return this.getTitle()||this.getContent()},e.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},e.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},e.prototype.tip=function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip};var i=t.fn.popover;t.fn.popover=function(i){return this.each(function(){var o=t(this),n=o.data("bs.popover"),s="object"==typeof i&&i;n||o.data("bs.popover",n=new e(this,s)),"string"==typeof i&&n[i]()})},t.fn.popover.Constructor=e,t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(window.jQuery),+function(t){"use strict";function e(i,o){var n,s=t.proxy(this.process,this);this.$element=t(t(i).is("body")?window:i),this.$body=t("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",s),this.options=t.extend({},e.DEFAULTS,o),this.selector=(this.options.target||(n=t(i).attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=t([]),this.targets=t([]),this.activeTarget=null,this.refresh(),this.process()}e.DEFAULTS={offset:10},e.prototype.refresh=function(){var e=this.$element[0]==window?"offset":"position";this.offsets=t([]),this.targets=t([]);var i=this;this.$body.find(this.selector).map(function(){var o=t(this),n=o.data("target")||o.attr("href"),s=/^#\w/.test(n)&&t(n);return s&&s.length&&[[s[e]().top+(!t.isWindow(i.$scrollElement.get(0))&&i.$scrollElement.scrollTop()),n]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){i.offsets.push(this[0]),i.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,o=i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(e>=o)return a!=(t=s.last()[0])&&this.activate(t);for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(!n[t+1]||e<=n[t+1])&&this.activate(s[t])},e.prototype.activate=function(e){this.activeTarget=e,t(this.selector).parents(".active").removeClass("active");var i=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',o=t(i).parents("li").addClass("active");o.parent(".dropdown-menu").length&&(o=o.closest("li.dropdown").addClass("active")),o.trigger("activate")};var i=t.fn.scrollspy;t.fn.scrollspy=function(i){return this.each(function(){var o=t(this),n=o.data("bs.scrollspy"),s="object"==typeof i&&i;n||o.data("bs.scrollspy",n=new e(this,s)),"string"==typeof i&&n[i]()})},t.fn.scrollspy.Constructor=e,t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=i,this},t(window).on("load",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);e.scrollspy(e.data())})})}(window.jQuery),+function(t){"use strict";var e=function(e){this.element=t(e)};e.prototype.show=function(){var e=this.element,i=e.closest("ul:not(.dropdown-menu)"),o=e.attr("data-target");if(o||(o=e.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var n=i.find(".active:last a")[0],s=t.Event("show.bs.tab",{relatedTarget:n});if(e.trigger(s),!s.isDefaultPrevented()){var a=t(o);this.activate(e.parent("li"),i),this.activate(a,a.parent(),function(){e.trigger({type:"shown.bs.tab",relatedTarget:n})})}}},e.prototype.activate=function(e,i,o){function n(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),e.addClass("active"),a?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu")&&e.closest("li.dropdown").addClass("active"),o&&o()}var s=i.find("> .active"),a=o&&t.support.transition&&s.hasClass("fade");a?s.one(t.support.transition.end,n).emulateTransitionEnd(150):n(),s.removeClass("in")};var i=t.fn.tab;t.fn.tab=function(i){return this.each(function(){var o=t(this),n=o.data("bs.tab");n||o.data("bs.tab",n=new e(this)),"string"==typeof i&&n[i]()})},t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=i,this},t(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault(),t(this).tab("show")})}(window.jQuery),+function(t){"use strict";var e=function(i,o){this.options=t.extend({},e.DEFAULTS,o),this.$window=t(window).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(i),this.affixed=this.unpin=null,this.checkPosition()};e.RESET="affix affix-top affix-bottom",e.DEFAULTS={offset:0},e.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var i=t(document).height(),o=this.$window.scrollTop(),n=this.$element.offset(),s=this.options.offset,a=s.top,r=s.bottom;"object"!=typeof s&&(r=a=s),"function"==typeof a&&(a=s.top()),"function"==typeof r&&(r=s.bottom());var l=null!=this.unpin&&o+this.unpin<=n.top?!1:null!=r&&n.top+this.$element.height()>=i-r?"bottom":null!=a&&a>=o?"top":!1;this.affixed!==l&&(this.unpin&&this.$element.css("top",""),this.affixed=l,this.unpin="bottom"==l?n.top-o:null,this.$element.removeClass(e.RESET).addClass("affix"+(l?"-"+l:"")),"bottom"==l&&this.$element.offset({top:document.body.offsetHeight-r-this.$element.height()}))}};var i=t.fn.affix;t.fn.affix=function(i){return this.each(function(){var o=t(this),n=o.data("bs.affix"),s="object"==typeof i&&i;n||o.data("bs.affix",n=new e(this,s)),"string"==typeof i&&n[i]()})},t.fn.affix.Constructor=e,t.fn.affix.noConflict=function(){return t.fn.affix=i,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),i=e.data();i.offset=i.offset||{},i.offsetBottom&&(i.offset.bottom=i.offsetBottom),i.offsetTop&&(i.offset.top=i.offsetTop),e.affix(i)})})}(window.jQuery); !function(t){"use strict";var e={defaultLocale:"en",locale:"en",placeholder:/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,translations:{}};t.init=function(){for(var n in e)t[n]="undefined"!=typeof t[n]?t[n]:e[n]},t.init(),t.translateInlineHTML=function(){[].forEach.call(document.querySelectorAll("[data-y18n]"),function(e){e.innerHTML=t.translate(e.getAttribute("data-y18n"))}),[].forEach.call(document.querySelectorAll("[data-y18n-title]"),function(e){e.title=t.translate(e.getAttribute("data-y18n-title"))})},t.translate=function(e,n){n=n||{locale:t.locale},n.locale=n.locale||t.locale;var l=this.lookup(e,n);return"undefined"!=typeof l&&l!==e||n.locale===t.defaultLocale?l?l.printf(n):e:(n.locale=t.defaultLocale,this.translate(e,n))},t.lookup=function(e,n){return"undefined"==typeof n.locale&&(n.locale=t.locale),"undefined"!=typeof t.translations[n.locale]&&"undefined"!=typeof t.translations[n.locale][e]?t.translations[n.locale][e]:void 0},t.t=t.translate}("undefined"==typeof exports?this.y18n||(this.y18n={}):exports),String.prototype.printf=function(t){var e=!1,n=arguments,l=-1;return"string"==typeof n[0]&&(e=!0),t instanceof Array||e?this.replace(/\%s/g,function(a,o){if(l++,e){if("string"==typeof n[l])return n[l];throw new Error("Arguments element is an invalid type")}return t[l]}):this.replace(/{([^{}]*)}/g,function(e,n){var l=t[n];return"string"==typeof l||"number"==typeof l?l:e})}; !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

'+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.redirect(n.get("path-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"]&&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",function(n){n.api("/domains/main",function(a){domain={name:n.params.domain,main:n.params.domain==a.current_main_domain?!0:!1,url:"https://"+n.params.domain},n.view("domain/domain_info",domain)},"PUT")}),n.get("#/domains/:domain/dns",function(n){n.api("/domains/"+n.params.domain+"/dns",function(a){domain={name:n.params.domain,dns:a},n.view("domain/domain_dns",domain)})}),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")})})}(); -!function(){var e=Sammy.apps["#main"],t=e.store;e.get("#/",function(e){e.api("/users",function(t){0===t.users.length&&e.flash("warning",y18n.t("warning_first_user"));var n="https://yunohost.org/security.rss",a="https://forum.yunohost.org";$.ajax({url:n,dataType:"xml"}).done(function(t){$.cookie.json=!0;var n=$.cookie("ynhSecurityViewedItems")||[];$("item",t).each(function(t,i){var o=$("link",i)[0].innerHTML;"string"==typeof o&&""!==o&&"/"==o.charAt(0)&&(o=a+o);var r=$("description",i)[0].textContent;r=r.replace('href="/','href="'+a+"/");var s={guid:$("guid",i)[0].innerHTML,title:$("title",i)[0].innerHTML,url:o,desc:r,date:$("pubDate",i)[0].innerHTML.split(" +")[0]};if(-1===n.indexOf(s.guid)){var l=s.title+' ('+y18n.t("read_more")+")";e.flash("warning",l),n.push(s.guid)}}),$.cookie("ynhSecurityViewedItems",n,{expire:7})}).fail(function(){e.flash("fail",y18n.t("error_retrieve_feed",[n]))}),e.view("home")})}),e.get("#/login",function(n){$("#masthead").show(),$("#masthead .logout-btn").hide(),t.set("path-1","#/login"),0===$("div.loader").length&&$("#main").append('
'),n.checkInstall(function(t){t?(domain=window.location.hostname,$("div.loader").remove(),n.view("login",{domain:domain})):"undefined"==typeof t?e.isInstalledTry>0?(e.isInstalledTry--,e.loaded=!1,setTimeout(function(){n.redirect("#/")},5e3)):(e.isInstalledTry=3,$(document).ajaxError(function(e,t,a){200!==t.status&&n.flash("fail",y18n.t("api_not_responding",[t.status+" "+t.statusText])),$(document).off("ajaxError")}),e.loaded=!0,$("div.loader").remove()):($("div.loader").remove(),n.redirect("#/postinstall"))})}),e.post("#/login",function(e){t.set("url",e.params.domain+"/yunohost/api"),params={password:e.params.password},e.api("/login",function(n){t.set("connected",!0),$("#masthead .logout-btn").fadeIn(),e.flash("success",y18n.t("logged_in")),t.get("path")?e.redirect(t.get("path")):e.redirect("#/")},"POST",params,!1)}),e.get("#/logout",function(e){e.api("/logout",function(n){t.clear("url"),t.clear("connected"),t.set("path","#/"),e.flash("success",y18n.t("logged_out")),e.redirect("#/login")},"GET",{},!1)})}(); +!function(){var e=Sammy.apps["#main"],t=e.store;e.get("#/",function(e){e.api("/users",function(t){0===t.users.length&&e.flash("warning",y18n.t("warning_first_user"));var n="https://yunohost.org/security.rss",a="https://forum.yunohost.org";$.ajax({url:n,dataType:"xml"}).done(function(t){$.cookie.json=!0;var n=$.cookie("ynhSecurityViewedItems")||[];$("item",t).each(function(t,i){var o=$("link",i)[0].innerHTML;"string"==typeof o&&""!==o&&"/"==o.charAt(0)&&(o=a+o);var r=$("description",i)[0].textContent;r=r.replace('href="/','href="'+a+"/");var s={guid:$("guid",i)[0].innerHTML,title:$("title",i)[0].innerHTML,url:o,desc:r,date:$("pubDate",i)[0].innerHTML.split(" +")[0]};if(-1===n.indexOf(s.guid)){var l=s.title+' ('+y18n.t("read_more")+")";e.flash("warning",l),n.push(s.guid)}}),$.cookie("ynhSecurityViewedItems",n,{expire:7})}).fail(function(){e.flash("fail",y18n.t("error_retrieve_feed",[n]))}),e.view("home")})}),e.get("#/login",function(n){$("#masthead").show().find(".logout-btn").hide(),t.set("path-1","#/login"),0===$("div.loader").length&&$("#main").append('
'),n.checkInstall(function(t){t?(domain=window.location.hostname,$("div.loader").remove(),n.view("login",{domain:domain})):"undefined"==typeof t?e.isInstalledTry>0?(e.isInstalledTry--,e.loaded=!1,setTimeout(function(){n.redirect("#/")},5e3)):(e.isInstalledTry=3,$(document).ajaxError(function(e,t,a){200!==t.status&&n.flash("fail",y18n.t("api_not_responding",[t.status+" "+t.statusText])),$(document).off("ajaxError")}),e.loaded=!0,$("div.loader").remove()):($("div.loader").remove(),n.redirect("#/postinstall"))})}),e.post("#/login",function(e){t.set("url",e.params.domain+"/yunohost/api"),params={password:e.params.password},e.api("/login",function(n){t.set("connected",!0),$("#masthead .logout-btn").fadeIn(),e.flash("success",y18n.t("logged_in")),t.get("path")?e.redirect(t.get("path")):e.redirect("#/")},"POST",params,!1)}),e.get("#/logout",function(e){e.api("/logout",function(n){t.clear("url"),t.clear("connected"),t.set("path","#/"),e.flash("success",y18n.t("logged_out")),e.redirect("#/login")},"GET",{},!1)})}(); !function(){var o=Sammy.apps["#main"];o.store;o.get("#/tools/monitor",function(o){monitorData={},o.api("/services/glances",function(t){monitorData.status=!0,"running"==t.status?o.api("/monitor/system",function(t){monitorData.system=t,o.api("/monitor/disk",function(t){monitorData.disk=t,o.api("/monitor/network",function(t){monitorData.network=t,delete monitorData.network.usage.lo,o.api("/version",function(t){monitorData.versions=t,o.view("tools/tools_monitoring",monitorData)})})})}):(monitorData.status=!1,o.view("tools/tools_monitoring",monitorData))},"GET")})}(); !function(){var a=Sammy.apps["#main"],n=a.store;a.get("#/postinstall",function(a){$("#masthead").hide(),a.checkInstall(function(n){n||"undefined"==typeof n?a.redirect("#/login"):a.view("postinstall/postinstall_1")})}),a.get("#/postinstall/domain",function(a){$("#masthead").hide(),$.get("https://dyndns.yunohost.org/domains",function(){}).done(function(n){a.params.ddomains=n.map(function(a){return"."+a})}).fail(function(){a.params.ddomains=[".nohost.me",".noho.st"]}).always(function(){a.view("postinstall/postinstall_2",a.params,function(){$("#domain, #ddomain").keyup(function(a){13==a.keyCode&&$("a.savedomain").click()}),$("a.savedomain").on("click",function(o){""===$("#domain").val()?""===$("#ddomain").val()?(o.preventDefault(),n.clear("slide"),a.flash("fail",y18n.t("error_select_domain"))):domain=$("#ddomain").val()+$('select[name="ddomain-ext"]').val():domain=$("#domain").val(),n.set("maindomain",domain)})})})}),a.get("#/postinstall/password",function(a){$("#masthead").hide(),n.get("maindomain")?a.view("postinstall/postinstall_3",{domain:n.get("maindomain").toLowerCase()}):(n.clear("slide"),a.redirect("#/postinstall/domain"))}),a.post("#/postinstall",function(a){""===a.params.password||""===a.params.confirmation?a.flash("fail",y18n.t("password_empty")):a.params.password==a.params.confirmation?(""===a.params.domain?(a.flash("fail",y18n.t("error_select_domain")),n.clear("slide"),a.redirect("#/postinstall/domain")):params={domain:a.params.domain.toLowerCase()},a.confirm(y18n.t("postinstall"),y18n.t("confirm_postinstall",[a.params.domain]),function(){params.password=a.params.password,n.set("url",window.location.hostname+"/yunohost/api"),n.set("user","admin"),a.api("/postinstall",function(n){a.redirect("#/login")},"POST",params)},function(){})):a.flash("fail",y18n.t("passwords_dont_match"))})}(); !function(){var e=Sammy.apps["#main"],a=e.store;e.get("#/services",function(e){e.api("/services",function(a){data2={services:[]},$.each(a,function(e,a){a.name=e,a.is_loaded="enabled"==a.loaded?!0:!1,a.is_running="running"==a.status?!0:!1,a.status=y18n.t(a.status),a.loaded=y18n.t(a.loaded),data2.services.push(a)}),e.view("service/service_list",data2)})}),e.get("#/services/:service",function(e){e.api("/services/"+e.params.service,function(s){data2={service:s},data2.service.name=e.params.service,data2.service.is_loaded="enabled"==s.loaded?!0:!1,data2.service.is_running="running"==s.status?!0:!1,data2.service.status=y18n.t(s.status),data2.service.loaded=y18n.t(s.loaded),a.clear("slide"),e.view("service/service_info",data2)},"GET")}),e.get("#/services/:service/log",function(e){params={number:50},e.api("/services/"+e.params.service+"/log",function(a){data2={logs:[],name:e.params.service},$.each(a,function(e,a){data2.logs.push({filename:e,filecontent:a.join("\n")})}),e.view("service/service_log",data2)},"GET",params)}),e.get("#/services/:service/:action",function(e){e.confirm("Service",y18n.t("confirm_service_action",[y18n.t(e.params.action),e.params.service]),function(){var s=null,i=e.params.service;switch(e.params.action){case"start":s="PUT";break;case"stop":s="DELETE";break;case"enable":s="PUT",i+="/enable";break;case"disable":s="DELETE",i+="/enable";break;default:e.flash("fail",y18n.t("unknown_action",[e.params.action])),a.clear("slide"),e.redirect("#/services/"+e.params.service)}s&&i?e.api("/services/"+i,function(s){a.clear("slide"),e.redirect("#/services/"+e.params.service)},s):(a.clear("slide"),e.redirect("#/services/"+e.params.service))},function(){a.clear("slide"),e.redirect("#/services/"+e.params.service)})})}(); diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index ab336d08..30cd6978 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -133,7 +133,7 @@ } if (uri !== '/postinstall') { store.clear('slide'); - c.view(store.get('path-1'), null, null, false); + c.redirect(store.get('path-1')); } }); };