mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.3.1'
This commit is contained in:
@@ -20,10 +20,16 @@ import gplx.core.consoles.*; import gplx.langs.htmls.encoders.*;
|
||||
public class Xof_file_wkr_ {
|
||||
private static final gplx.core.security.Hash_algo md5_hash = gplx.core.security.Hash_algo_.New__md5();
|
||||
public static final Gfo_url_encoder Md5_decoder = Gfo_url_encoder_.New__http_url().Init__same__many(Byte_ascii.Plus).Make();
|
||||
public static byte[] Md5_fast(byte[] v) {return md5_hash.Hash_bry_as_bry(v);}
|
||||
public static byte[] Md5_fast(byte[] v) {
|
||||
synchronized (md5_hash) {
|
||||
return md5_hash.Hash_bry_as_bry(v);
|
||||
}
|
||||
}
|
||||
public static byte[] Md5(byte[] ttl) {
|
||||
ttl = Md5_decoder.Decode(Ttl_standardize(ttl));
|
||||
return Xof_file_wkr_.Md5_fast(ttl); // NOTE: md5 is calculated off of url_decoded ttl; EX: A%2Cb is converted to A,b and then md5'd. note that A%2Cb still remains the title
|
||||
synchronized (md5_hash) {
|
||||
ttl = Md5_decoder.Decode(Ttl_standardize(ttl));
|
||||
return Xof_file_wkr_.Md5_fast(ttl); // NOTE: md5 is calculated off of url_decoded ttl; EX: A%2Cb is converted to A,b and then md5'd. note that A%2Cb still remains the title
|
||||
}
|
||||
}
|
||||
public static byte[] Ttl_standardize(byte[] src) {
|
||||
int len = src.length; if (len == 0) return src;
|
||||
|
||||
@@ -28,6 +28,7 @@ public class Xou_cache_mgr {
|
||||
this.cfg_tbl = db_file.Tbl__cfg();
|
||||
this.cache_tbl = db_file.Tbl__cache();
|
||||
}
|
||||
public boolean Enabled() {return enabled;} private boolean enabled = true; public void Enabled_n_() {enabled = false;}
|
||||
public int Fsys_count_cur() {return hash.Count();}
|
||||
public long Fsys_size_cur() {return fsys_size_cur;} private long fsys_size_cur = 0;
|
||||
public long Fsys_size_min() {return fsys_size_min;} public void Fsys_size_min_(long v) {fsys_size_min = v;} private long fsys_size_min = Io_mgr.Len_mb * 75;
|
||||
@@ -50,6 +51,7 @@ public class Xou_cache_mgr {
|
||||
}
|
||||
public Xou_cache_itm Get_or_null(Xof_fsdb_itm fsdb) {return Get_or_null(fsdb.Lnki_wiki_abrv(), fsdb.Lnki_ttl(), fsdb.Lnki_type(), fsdb.Lnki_upright(), fsdb.Lnki_w(), fsdb.Lnki_h(), fsdb.Lnki_time(), fsdb.Lnki_page(), fsdb.User_thumb_w());}
|
||||
public Xou_cache_itm Get_or_null(byte[] wiki, byte[] ttl, int type, double upright, int w, int h, double time, int page, int user_thumb_w) {
|
||||
if (!enabled) return null;
|
||||
synchronized (thread_lock) {
|
||||
this.Page_bgn();
|
||||
byte[] key = Xou_cache_itm.Key_gen(key_bfr, wiki, ttl, type, upright, w, h, time, page, user_thumb_w);
|
||||
|
||||
@@ -19,10 +19,11 @@ package gplx.xowa.files.caches; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.files.origs.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.fsdb.*; import gplx.xowa.files.bins.*; import gplx.xowa.guis.cbks.js.*;
|
||||
public class Xou_file_itm_finder {
|
||||
private final Xou_cache_mgr cache_mgr; private final Xof_img_size img_size = new Xof_img_size(); private final Xof_url_bldr url_bldr = Xof_url_bldr.new_v2();
|
||||
private final Xou_cache_mgr cache_mgr; private final Xof_img_size img_size = new Xof_img_size();
|
||||
public Xou_file_itm_finder(Xou_cache_mgr cache_mgr) {this.cache_mgr = cache_mgr;}
|
||||
public boolean Find(Xowe_wiki wiki, int exec_tid, Xof_file_itm xfer, byte[] page_url) {
|
||||
byte[] lnki_ttl = xfer.Lnki_ttl();
|
||||
Xof_url_bldr url_bldr = wiki.Parser_mgr().Url_bldr();
|
||||
try {
|
||||
if (wiki.File__fsdb_mode().Tid_v2_bld()) return false; // disable during build
|
||||
Xou_cache_itm cache_itm = cache_mgr.Get_or_null(wiki.Domain_itm().Abrv_xo(), lnki_ttl, xfer.Lnki_type(), xfer.Lnki_upright(), xfer.Lnki_w(), xfer.Lnki_h(), xfer.Lnki_time(), xfer.Lnki_page(), Xof_img_size.Thumb_width_img);
|
||||
|
||||
Reference in New Issue
Block a user