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 @@
return gadget.getDeclaredGadget("model")
.push(function (model) {
model_gadget = model;
})
.push(function () {
return gadget.getDeclaredGadget("result");
})
.push(function (result) {
result_gadget = result;
return model_gadget.getConfig()
.push(function (config) {
if (!config)
return ["https://proxy1.mynij.com/proxy"];
return config.proxies.urls;
});
return model_gadget.getConfig();
})
.push(function (result) {
.push(function (config) {
var proxies = ["https://proxy1.mynij.com/proxy"],
searx = "https://searx.mynij.com/search",
store = "https://store.mynij.com";
if (!config)
config = {proxies: [], searx: {}, store: {}};
return gadget.changeState({
model_gadget : model_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 @@
proxy = gadget.state.proxies[rng],
query = encodeURI(key);
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"
});
})
......@@ -261,10 +261,7 @@
select.onchange = function (e) {
e.preventDefault();
if (e.target.value === "ADD") {
//return gadget.redirect({"command": "display", "options": {
// page: "ojs_local_controller"
//}});
window.location.href = "https://store.mynij.com";
window.location.href = gadget.state.store;
}
};
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.61392.62575.19643</string> </value>
<value> <string>994.63871.12230.4334</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1632241192.69</float>
<float>1632390220.27</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,10 +11,14 @@
},
"proxies": {
"urls": [
"https://proxy1.mynij.com/proxy"
"https://proxy1.mynij.com/proxy",
"https://proxy2.mynij.com/proxy"
]
},
"searchx": {
"searx": {
"url": "https://searx.mynij.com/search"
},
"store": {
"url": "https://store.mynij.com"
}
}
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.39448.18769.55569</string> </value>
<value> <string>994.63878.38139.10990</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1631198847.97</float>
<float>1632390675.99</float>
<string>UTC</string>
</tuple>
</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