Commit a0e01a6b authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: Use searx and store url from Config file

parent 961d8235
...@@ -23,24 +23,24 @@ ...@@ -23,24 +23,24 @@
return gadget.getDeclaredGadget("model") return gadget.getDeclaredGadget("model")
.push(function (model) { .push(function (model) {
model_gadget = model; model_gadget = model;
})
.push(function () {
return gadget.getDeclaredGadget("result"); return gadget.getDeclaredGadget("result");
}) })
.push(function (result) { .push(function (result) {
result_gadget = result; result_gadget = result;
return model_gadget.getConfig() return model_gadget.getConfig();
})
.push(function (config) { .push(function (config) {
var proxies = ["https://proxy1.mynij.com/proxy"],
searx = "https://searx.mynij.com/search",
store = "https://store.mynij.com";
if (!config) if (!config)
return ["https://proxy1.mynij.com/proxy"]; config = {proxies: [], searx: {}, store: {}};
return config.proxies.urls;
});
})
.push(function (result) {
return gadget.changeState({ return gadget.changeState({
model_gadget : model_gadget, model_gadget : model_gadget,
result_gadget : result_gadget, result_gadget : result_gadget,
proxies: result proxies: config.proxies.urls || proxies,
searx: config.searx.url || searx,
store: config.store.url || store
}); });
}); });
}) })
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
proxy = gadget.state.proxies[rng], proxy = gadget.state.proxies[rng],
query = encodeURI(key); query = encodeURI(key);
return jIO.util.ajax({ return jIO.util.ajax({
url : proxy + "?url=https%3A%2F%2Fsoftinst141674.host.vifib.net%2Fsearch%3Fq%3D" + url : proxy + "?url=" + gadget.state.searx + "%3Fq%3D" +
query + "%26category_general%3Don%26theme%3Doscar" query + "%26category_general%3Don%26theme%3Doscar"
}); });
}) })
...@@ -261,10 +261,7 @@ ...@@ -261,10 +261,7 @@
select.onchange = function (e) { select.onchange = function (e) {
e.preventDefault(); e.preventDefault();
if (e.target.value === "ADD") { if (e.target.value === "ADD") {
//return gadget.redirect({"command": "display", "options": { window.location.href = gadget.state.store;
// page: "ojs_local_controller"
//}});
window.location.href = "https://store.mynij.com";
} }
}; };
}) })
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.61392.62575.19643</string> </value> <value> <string>994.63871.12230.4334</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1632241192.69</float> <float>1632390220.27</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,10 +11,14 @@ ...@@ -11,10 +11,14 @@
}, },
"proxies": { "proxies": {
"urls": [ "urls": [
"https://proxy1.mynij.com/proxy" "https://proxy1.mynij.com/proxy",
"https://proxy2.mynij.com/proxy"
] ]
}, },
"searchx": { "searx": {
"url": "https://searx.mynij.com/search" "url": "https://searx.mynij.com/search"
},
"store": {
"url": "https://store.mynij.com"
} }
} }
\ No newline at end of file
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.39448.18769.55569</string> </value> <value> <string>994.63878.38139.10990</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1631198847.97</float> <float>1632390675.99</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment