diff --git a/src/assets/images/amazon-icon.png b/src/assets/images/amazon-icon.png new file mode 100644 index 0000000..7278754 Binary files /dev/null and b/src/assets/images/amazon-icon.png differ diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index dcb03e2..3fcb7d4 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -56,6 +56,7 @@ function redirect(url, type, initiator, forceRedirection) { let randomInstance let frontend for (const service in config.services) { + console.log(service, options[service]) if (!forceRedirection && !options[service].enabled) continue frontend = options[service].frontend @@ -552,6 +553,20 @@ function redirect(url, type, initiator, forceRedirection) { if (url.hostname == "i.pinimg.com") return `${randomInstance}/image_proxy.php?url=${url.href}` return randomInstance } + case "simpleamazon": { + if (url.hostname == "amazon.co.jp" || url.hostname == "www.amazon.co.jp") { + //const regex = url.hostname.match(/\.\s/) + //console.log(regex) + if (url.pathname.startsWith('/s')) { + if (url.search) { + let query = url.search.split("?")[1].split("&") + query.forEach(x => { if (x.startsWith("k=")) query = x.split("=")[1] }) + return `${randomInstance}/s?k=${query}&page=1&s=&tld=co.jp` + } + return randomInstance + } + } + } case "spliti": { if (url.hostname == "news.mixi.jp") { if (url.search) { @@ -571,7 +586,6 @@ function redirect(url, type, initiator, forceRedirection) { if (url.hostname == "pixiv.net" || url.hostname == "www.pixiv.net") { let path = url.pathname if (url.pathname.startsWith('/en')) path = path.splice(3) - console.log(path) if (path.startsWith('/users')) { const illustid = /\/(\d+)\/?$/.exec(url.pathname)[1] if (path.includes('/illusts')) return `${randomInstance}/users/illusts/?id=${illustid}` @@ -713,6 +727,7 @@ const defaultInstances = { 'searxng': ['https://search.bus-hit.me'], 'rimgo': ['https://rimgo.vern.cc'], 'librarian': ['https://odysee.owacon.moe'], + 'simpleamazon': ['https://az.vern.cc'], 'beatbump': ['https://beatbump.ml'], 'hyperpipe': ['https://hyperpipe.surge.sh'], 'facil': [' https://facilmap.org '], diff --git a/src/config.json b/src/config.json index 71bcbb7..45a9c00 100644 --- a/src/config.json +++ b/src/config.json @@ -154,6 +154,32 @@ "embeddable": true, "url": "https://news.mixi.jp" }, + "amazon": { + "frontends": { + "simpleamazon": { + "name": "SimpleAmazon", + "embeddable": false, + "instanceList": true, + "url": "https://codeberg.org/SimpleWeb/SimpleAmazon", + "localhost": true + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?amazon\\.com\\/s(\\/|$)", + "^https?:\\/{2}(www\\.)?amazon\\.co.jp\\/s(\\/|$)" + ], + "name": "Amazon", + "options": { + "enabled": false, + "redirectType": "main_frame", + "unsupportedUrls": "bypass", + "frontend": "simpleamazon", + "instance": "public" + }, + "imageType": "png", + "embeddable": true, + "url": "https://amazon.co.jp" + }, "pixiv": { "frontends": { "vixip": {