1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-08-24 00:32:13 -04:00
parent df10db140c
commit ed911e3de5
220 changed files with 2618 additions and 1569 deletions

View File

@@ -20,9 +20,16 @@ import gplx.core.primitives.*;
public class Xoa_app_type {
Xoa_app_type(int uid) {this.uid = uid;}
public int Uid() {return uid;} private final int uid;
public boolean Uid_is_gui() {return uid == Uid_gui;}
public boolean Uid_is_tcp() {return uid == Uid_tcp;}
public boolean Uid_is_http() {return uid == Uid_http;}
public boolean Uid_is_gui() {return uid == Uid_gui;}
public boolean Uid_is_tcp() {return uid == Uid_tcp;}
public boolean Uid_is_http() {return uid == Uid_http;}
public boolean Uid_supports_js() {
switch (uid) {
case Uid_gui:
case Uid_tcp: return true;
default: return false;
}
}
public byte[] Name() {
switch (uid) {
case Uid_cmd: return Key_cmd;

View File

@@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
import gplx.core.consoles.*;
import gplx.xowa.wikis.*;
import gplx.xowa.html.hrefs.*;
public class Xoa_shell implements GfoInvkAble {
public Xoa_shell(Xoae_app app) {this.app = app;} private Xoae_app app;
public boolean Fetch_page_exec_async() {return fetch_page_exec_async;} private boolean fetch_page_exec_async = true;
@@ -29,7 +31,8 @@ public class Xoa_shell implements GfoInvkAble {
}
private String Fetch_page(GfoMsg m) {
String url = m.ReadStr("url");
if (String_.Has_at_bgn(url, "//")) url = String_.Replace(url, "//", ""); // NOTE: handle Firefox_addon which sometimes sends urls of the form "//wiki/" when coming from the sidebar; DATE:2015-07-04
if (String_.Eq(url, "home")) url = Xoa_url_.Main_page__home_str; // WORKAROUND.ADDON: toolbar button sends "home"; note that Fetch_page is only called from command-line / addon, so "home" should never mean "home" page in current wiki; EX: en.wikipedia.org/wiki/home; DATE:2015-08-18
if (String_.Has_at_bgn(url, "//")) url = gplx.core.net.Gfo_protocol_itm.Itm_https.Key_w_colon_str() + url; // WORKAROUND.ADDON: sidebar sends urls of form "//en.wikipedia.org/"; prefix with "https:" so url parser can handle it; DATE:2015-07-05; DATE:2015-08-18
return String_.new_u8(app.Gui_mgr().Browser_win().App__retrieve_by_url(url, m.ReadStrOr("output_type", "html")));
}
private static final String Invk_fetch_page = "fetch_page"

View File

@@ -16,7 +16,7 @@ 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.apps.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
import gplx.xowa.wikis.*;
import gplx.xowa.wikis.domains.*;
public class Xoa_fsys_mgr implements GfoInvkAble {
public Xoa_fsys_mgr(String plat_name, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url css_dir) {
this.root_dir = root_dir;
@@ -31,7 +31,7 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
this.cfg_lang_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "lang", "core");
this.cfg_wiki_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "core");
this.cfg_site_meta_fil = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "site_meta.sqlite3");
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_.Domain_str_home);
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_itm_.Str__home);
}
public Io_url Root_dir() {return root_dir;} private final Io_url root_dir;
public Io_url Wiki_dir() {return wiki_dir;} private final Io_url wiki_dir;