mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-30 14:04:56 +00:00
HTTP Server: Show error page when navigating to wikis which are not installed [#613]
This commit is contained in:
parent
9483b56121
commit
e9024e057f
@ -126,6 +126,7 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
|
||||
public byte[] Wtxt__expand_tmpl(byte[] src) {return parser_mgr.Main().Expand_tmpl(src);}
|
||||
public boolean Embeddable_enabled() {return embeddable_enabled;} public void Embeddable_enabled_(boolean v) {this.embeddable_enabled = v;} private boolean embeddable_enabled;
|
||||
public Hxtn_page_mgr Hxtn_mgr() {return hxtn_mgr;} private final Hxtn_page_mgr hxtn_mgr = new Hxtn_page_mgr();
|
||||
public boolean Installed() {return this.Data__core_mgr() != null;} // not sure if this is the best way
|
||||
|
||||
public Xow_hdump_mgr Html__hdump_mgr() {return html__hdump_mgr;} private final Xow_hdump_mgr html__hdump_mgr;
|
||||
public Xoae_app Appe() {return app;} private Xoae_app app;
|
||||
|
@ -40,6 +40,11 @@ public class Http_server_page {
|
||||
public boolean Make_url(byte[] wiki_domain, byte[] ttl_bry_arg, byte[] qarg) {
|
||||
// get wiki
|
||||
wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_or_make_init_y(wiki_domain); // assert init for Main_Page; EX:click zh.w on wiki sidebar; DATE:2015-07-19
|
||||
if (!wiki.Installed()) {
|
||||
this.ttl = wiki.Ttl_parse(Xow_special_meta_.Itm__error.Ttl_bry());
|
||||
this.url = wiki.Utl__url_parser().Parse(Xoerror_special.Make_url__invalidWiki(wiki_domain));
|
||||
return true;
|
||||
}
|
||||
if (Runtime_.Memory_total() > Io_mgr.Len_gb) Xowe_wiki_.Rls_mem(wiki, true); // release memory at 1 GB; DATE:2015-09-11
|
||||
|
||||
// get url
|
||||
|
@ -31,6 +31,10 @@ public class Xoerror_special implements Xow_special_page {
|
||||
title = "Invalid title";
|
||||
msg = "The title has invalid characters: <span style='color:red;font-weight:bold'>" + data + "</span>";
|
||||
}
|
||||
else if (String_.Eq(type, "InvalidWiki")) {
|
||||
title = "Invalid wiki";
|
||||
msg = "The wiki is not installed: <span style='color:red;font-weight:bold'>" + data + "</span>";
|
||||
}
|
||||
|
||||
page.Db().Text().Text_bry_(fmt.Bld_many_to_bry(Bry_bfr_.New(), title, msg));
|
||||
}
|
||||
@ -41,7 +45,10 @@ public class Xoerror_special implements Xow_special_page {
|
||||
));
|
||||
|
||||
public Xow_special_page Special__clone() {return this;}
|
||||
public static byte[] Make_url__invalidTitle(byte[] invalid_title) {
|
||||
return Bry_.Add(Xow_special_meta_.Itm__error.Ttl_bry(), Bry_.new_a7("?type=InvalidTitle&data="), invalid_title);
|
||||
public static byte[] Make_url__invalidTitle(byte[] ttl_bry) {
|
||||
return Bry_.Add(Xow_special_meta_.Itm__error.Ttl_bry(), Bry_.new_a7("?type=InvalidTitle&data="), ttl_bry);
|
||||
}
|
||||
public static byte[] Make_url__invalidWiki(byte[] wiki) {
|
||||
return Bry_.Add(Xow_special_meta_.Itm__error.Ttl_bry(), Bry_.new_a7("?type=InvalidWiki&data="), wiki);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user