From cda818783aecd5918ea3c71515c6d3a7fdaa58db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 7 Feb 2016 19:55:12 +0100 Subject: [PATCH] [fix] Define domain addition route before domain info. --- src/dist/js/script.min.js | 2 +- src/js/yunohost/controllers/domains.js | 48 +++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/dist/js/script.min.js b/src/dist/js/script.min.js index f9f9e96e..6798a0f6 100644 --- a/src/dist/js/script.min.js +++ b/src/dist/js/script.min.js @@ -15,7 +15,7 @@ if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(t){"use strict !function(){var a=Sammy.apps["#main"],n=a.store;a.before(/domains\/add/,function(a){a.params.domains=[],a.api("/domains",function(n){a.params.domains=n.domains})}),a.before(/apps\/install\//,function(a){a.params.domains=[],a.api("/domains",function(n){a.params.domains=n.domains})}),a.before(/apps\/install\//,function(a){a.params.users=[],a.api("/users",function(n){a.params.users=n.users})}),a.before({except:{path:["#/logout","#/login","#/postinstall","#/postinstall/domain","#/postinstall/password"]}},function(a){return n.set("path-1",n.get("path")),n.set("path",a.path),n.get("connected")?void 0:(a.redirect("#/login"),!1)}),a.after(function(){})}(); !function(){var a=Sammy.apps["#main"],s=a.store;a.get("#/apps",function(a){a.api("/apps",function(s){apps=[],$.each(s.apps,function(a,s){s.installed&&apps.push(s)}),a.arraySortById(apps),a.view("app/app_list",{apps:apps})})}),a.get("#/apps/install",function(a){a.api("/apps",function(s){a.api("/apps?raw",function(e){apps=[],$.each(s.apps,function(a,s){s.installed&&"true"!=e[s.id].manifest.multi_instance||s.id.match(/__[0-9]{1,5}$/)||apps.push(s)}),a.arraySortById(apps),a.view("app/app_list_install",{apps:apps})})})}),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/: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/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 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 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")})}(); diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js index 20a60eec..f9335fe8 100644 --- a/src/js/yunohost/controllers/domains.js +++ b/src/js/yunohost/controllers/domains.js @@ -30,29 +30,6 @@ }); }); - // List existing domains - app.get('#/domains/:domain', function (c) { - c.api('/domains/main', function(dataMain) { - domain = { - name: c.params['domain'], - main: (c.params['domain'] == dataMain.current_main_domain) ? true : false, - url: "https://"+c.params['domain'] - } - c.view('domain/domain_info', domain); - }, 'PUT'); - }); - - // Domain DNS - app.get('#/domains/:domain/dns', function (c) { - c.api('/domains/' + c.params['domain'] + '/dns', function(data) { - domain = { - name: c.params['domain'], - dns: data - } - c.view('domain/domain_dns', domain); - }); - }); - // Add domain form app.get('#/domains/add', function (c) { $.get('https://dyndns.yunohost.org/domains', function() {}) @@ -101,6 +78,29 @@ }, 'POST', params); }); + // Get existing domain info + app.get('#/domains/:domain', function (c) { + c.api('/domains/main', function(dataMain) { + domain = { + name: c.params['domain'], + main: (c.params['domain'] == dataMain.current_main_domain) ? true : false, + url: "https://"+c.params['domain'] + } + c.view('domain/domain_info', domain); + }, 'PUT'); + }); + + // Domain DNS + app.get('#/domains/:domain/dns', function (c) { + c.api('/domains/' + c.params['domain'] + '/dns', function(data) { + domain = { + name: c.params['domain'], + dns: data + } + c.view('domain/domain_dns', domain); + }); + }); + // Remove existing domain app.get('#/domains/:domain/delete', function (c) { c.confirm( @@ -150,4 +150,4 @@ } }); -})(); \ No newline at end of file +})();