1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Cfg: Convert 'App - Security'

This commit is contained in:
gnosygnu
2016-12-15 11:25:22 -05:00
parent 5073db8044
commit 38f5f6de7c
27 changed files with 107 additions and 205 deletions

View File

@@ -21,25 +21,21 @@ public class Xou_cfg implements Gfo_invk {
this.user = user;
pages_mgr = new Xouc_pages_mgr(this); startup_mgr = new Xouc_startup_mgr(this); setup_mgr = new Xouc_setup_mgr(user);
layout_mgr = new Xoc_layout_mgr(user.Appe());
security_mgr = new Xou_security_mgr(user.Appe());
}
public Xoue_user User() {return user;} private Xoue_user user;
public Xouc_pages_mgr Pages_mgr() {return pages_mgr;} private Xouc_pages_mgr pages_mgr;
public Xouc_startup_mgr Startup_mgr() {return startup_mgr;} private Xouc_startup_mgr startup_mgr;
public Xouc_setup_mgr Setup_mgr() {return setup_mgr;} private Xouc_setup_mgr setup_mgr;
public Xoc_layout_mgr Layout_mgr() {return layout_mgr;} private Xoc_layout_mgr layout_mgr;
public Xou_security_mgr Security_mgr() {return security_mgr;} private Xou_security_mgr security_mgr;
public Xou_log_mgr Log_mgr() {return log_mgr;} private final Xou_log_mgr log_mgr = new Xou_log_mgr();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_pages)) return pages_mgr;
else if (ctx.Match(k, Invk_startup)) return startup_mgr;
else if (ctx.Match(k, Invk_setup)) return setup_mgr;
else if (ctx.Match(k, Invk_layout)) return layout_mgr;
else if (ctx.Match(k, Invk_security)) return security_mgr;
else if (ctx.Match(k, Invk_log)) return log_mgr;
return this;
}
public static final String
Invk_pages = "pages", Invk_startup = "startup", Invk_setup = "setup", Invk_layout = "layout", Invk_security = "security", Invk_log = "log"
;
Invk_pages = "pages", Invk_startup = "startup", Invk_setup = "setup", Invk_layout = "layout", Invk_log = "log";
}

View File

@@ -1,30 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
public class Xou_security_mgr implements Gfo_invk {
public Xou_security_mgr(Xoae_app app) {this.app = app;} private Xoae_app app;
public boolean Web_access_enabled() {return app.Api_root().Net().Enabled();}
public void Web_access_enabled_(boolean v) {app.Api_root().Net().Enabled_(v);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_web_access_enabled)) return Yn.To_str(this.Web_access_enabled());
else if (ctx.Match(k, Invk_web_access_enabled_)) Web_access_enabled_(m.ReadYn("v"));
return this;
}
public static final String
Invk_web_access_enabled = "web_access_enabled", Invk_web_access_enabled_ = "web_access_enabled_";
}

View File

@@ -69,7 +69,7 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
public void App_term() {
session_mgr.Window_mgr().Save_window(app.Gui_mgr().Browser_win().Win_box());
history_mgr.Save(app);
if (app.Gui_mgr().Browser_win().Tab_mgr().Html_load_tid__url())
if (app.Gui_mgr().Browser_win().Tab_mgr().Page_load_mode_is_url())
Io_mgr.Instance.DeleteDirDeep(fsys_mgr.App_temp_html_dir());
app.File_mgr().Cache_mgr().Db_term();
}

View File

@@ -23,13 +23,14 @@ public class Xou_history_mgr implements Gfo_invk {
private Ordered_hash itms = Ordered_hash_.New_bry();
private boolean load_chk = false;
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
private boolean log_all;
private boolean log_all = false;
public Xou_history_mgr(Io_url history_fil) {
this.history_fil = history_fil;
}
public void Init_by_app(Xoa_app app) {
app.Cfg().Bind_many_app(this, Cfg__log_all);
app.Cfg().Bind_many_app(this, Cfg__enabled, Cfg__log_all);
}
public boolean Enabled() {return enabled;} private boolean enabled = true;
public int Len() {return itms.Count();}
public void Clear() {itms.Clear();}
public Xou_history_itm Get_at(int i) {return (Xou_history_itm)itms.Get_at(i);}
@@ -126,6 +127,7 @@ public class Xou_history_mgr implements Gfo_invk {
else if (ctx.Match(k, Invk_html_itm_)) html_mgr.Html_itm().Fmt_(m.ReadBry("v"));
else if (ctx.Match(k, Invk_current_itms_max_)) current_itms_max = m.ReadInt("v");
else if (ctx.Match(k, Invk_current_itms_reset_)) current_itms_reset = m.ReadInt("v");
else if (ctx.Match(k, Cfg__enabled)) enabled = m.ReadYn("v");
else if (ctx.Match(k, Cfg__log_all)) log_all = m.ReadYn("v");
else return Gfo_invk_.Rv_unhandled;
return this;
@@ -133,7 +135,7 @@ public class Xou_history_mgr implements Gfo_invk {
public static final String Invk_html_grp = "html_grp", Invk_html_grp_ = "html_grp_", Invk_html_itm = "html_itm", Invk_html_itm_ = "html_itm_", Invk_current_itms_max_ = "current_itms_max_", Invk_current_itms_reset_ = "current_itms_reset_";
public static final byte[] Ttl_name = Bry_.new_a7("XowaPageHistory");
public static final byte[] Ttl_full = Bry_.new_a7("Special:XowaPageHistory");
private static final String Cfg__log_all = "xowa.app.page_history.log_all";
private static final String Cfg__enabled = "xowa.app.page_history.enabled", Cfg__log_all = "xowa.app.page_history.log_all";
}
class Xou_history_itm_srl {
public static void Load(byte[] ary, Ordered_hash list) {