1
0
This commit is contained in:
syui 2024-04-26 14:25:37 +09:00
parent b979a790f1
commit fb26e949ee
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
3 changed files with 57 additions and 48 deletions

View File

@ -12,7 +12,7 @@
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
</head>
<body>
<div id="app"></div>
<div id="comment"></div>
<script async src="https://embed.bsky.app/static/embed.js" charset="utf-8"></script>
</body>
<footer>© syui</footer>

View File

@ -1,5 +1,6 @@
<template>
<div id="app">
<div id="comment">
<div class="comment-root">
<div class="loading" v-if="loading && cid_root">
<vue-loading type="cylon" color="#fff700" :size="{ width: '50px', height: '50px' }"></vue-loading>
</div>
@ -19,6 +20,7 @@
</span>
</div>
</div>
</div>
</template>
<script>
@ -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,11 +96,13 @@ 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"){
} else if (this.host === "192.168.11.12:8080"){
this.api_url = "/api/";
} else {
if (location.protocol !== "https:") {
@ -109,9 +115,12 @@ export default {
.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);
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);
}
}
);
}

View File

@ -5,5 +5,5 @@ Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')
}).$mount('#comment')