From fb26e949ee528b7eed0d25de4c5c06e481ea01b9 Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 26 Apr 2024 14:25:37 +0900 Subject: [PATCH] fix --- public/index.html | 2 +- src/App.vue | 101 +++++++++++++++++++++++++--------------------- src/main.js | 2 +- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/public/index.html b/public/index.html index 2944513..2bdc5bf 100644 --- a/public/index.html +++ b/public/index.html @@ -12,7 +12,7 @@ -
+
diff --git a/src/App.vue b/src/App.vue index f98e7ee..d71fb2f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,22 +1,24 @@ @@ -51,22 +53,24 @@ export default { }, data() { return { + host: window.location.host, loc: window.location.pathname, bsky_pds: "https://bsky.social/xrpc", bsky_handle: "yui.syui.ai", - bsky_cursor: null, + bsky_cursor: "", bsky_cid: "", - bsky_json: null, - api_url: null, - api_json: null, - api_json_record: null, - cid_root: null, - uri_root: null, + bsky_json: "", + api_url: "", + api_json: "", + api_json_record: "", + blog: "", + cid_root: "", + uri_root: "", comment_open: false, - comment_first: null, + comment_first: "", loading: true, avatar_url: "", - f: null, + f: "", url_check: true, url: "/", products: [...Array(Number(page)).keys()], @@ -92,28 +96,33 @@ export default { } }, mounted() { - if (window.location.host === "localhost:8080") { + if (this.host === "localhost:8080") { + this.host = "manga.syui.ai"; this.api_url = "/api/"; - } else if (window.location.host === "localhost:1313"){ + } else if (this.host === "localhost:1313"){ + this.host = "syui.ai"; this.api_url = "https://api.syui.ai"; - } else if (window.location.host === "192.168.11.12:8080"){ - this.api_url = "/api/"; - } else { - if (location.protocol !== "https:") { - location.replace("https:" + location.href.substring(location.protocol.length)); - } - this.api_url = "https://api.syui.ai"; - } - let url = this.api_url + "/users/2/ma?itemsPerPage=4000"; - axios - .get(url,{ crossdomain: true }) - .then( - response => {this.api_json = response - this.cid_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc).cid; - this.uri_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc).uri; - this.api_json_record = this.api_json.data.filter((v) => v.cid_root == this.cid_root); + } else if (this.host === "192.168.11.12:8080"){ + this.api_url = "/api/"; + } else { + if (location.protocol !== "https:") { + location.replace("https:" + location.href.substring(location.protocol.length)); } - ); + this.api_url = "https://api.syui.ai"; + } + let url = this.api_url + "/users/2/ma?itemsPerPage=4000"; + axios + .get(url,{ crossdomain: true }) + .then( + response => {this.api_json = response + const tmp = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc); + if (tmp !== undefined) { + this.cid_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc && v.blog === this.host).cid; + this.uri_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc && v.blog === this.host).uri; + this.api_json_record = this.api_json.data.filter((v) => v.cid_root == this.cid_root && v.blog === this.host); + } + } + ); } }; diff --git a/src/main.js b/src/main.js index a20b0c6..37c24e1 100644 --- a/src/main.js +++ b/src/main.js @@ -5,5 +5,5 @@ Vue.config.productionTip = false new Vue({ render: h => h(App) -}).$mount('#app') +}).$mount('#comment')