sbool serverMechList_raw_fresh_verbose; static S serverMechList_raw_fresh(S name) { ret serverMechList_raw_fresh(name, false); } static S serverMechList_raw_fresh(S name, bool opt) { lock downloadLock(); if (serverMechList_raw_fresh_verbose) print("serverMechList_raw_fresh " + name); S text = null; pcall { text = loadTextFile(remoteMechListMirrorFile(name)); } O[] params = muricaCredentialsPlus(md5 := md5OrNull(text), opt := opt ? 1 : 0, withStatus := 1); S url = "http://butter.botcompany.de:8080/mech/raw/list-text/" + urlencode(name); S page = postPageSilently(url, params); Map map = jsonDecodeMap(page); bool same = eq(map.get("Same"), true); if (serverMechList_raw_fresh_verbose) print("Mech list " + name + ": " + (same ? "same" : "downloaded")); if (same) ret text; text = (S) map.get("Text"); saveTextFile(remoteMechListMirrorFile(name), text); File nameFile = remoteMechListMirrorNameFile(name); if (!fileExists(nameFile)) { S actualName = or((S) map.get("Name"), name); saveTextFile(nameFile, actualName); } ret text; }