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

View File

@ -1,5 +1,6 @@
<template> <template>
<div id="app"> <div id="comment">
<div class="comment-root">
<div class="loading" v-if="loading && cid_root"> <div class="loading" v-if="loading && cid_root">
<vue-loading type="cylon" color="#fff700" :size="{ width: '50px', height: '50px' }"></vue-loading> <vue-loading type="cylon" color="#fff700" :size="{ width: '50px', height: '50px' }"></vue-loading>
</div> </div>
@ -19,6 +20,7 @@
</span> </span>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -51,22 +53,24 @@ export default {
}, },
data() { data() {
return { return {
host: window.location.host,
loc: window.location.pathname, loc: window.location.pathname,
bsky_pds: "https://bsky.social/xrpc", bsky_pds: "https://bsky.social/xrpc",
bsky_handle: "yui.syui.ai", bsky_handle: "yui.syui.ai",
bsky_cursor: null, bsky_cursor: "",
bsky_cid: "", bsky_cid: "",
bsky_json: null, bsky_json: "",
api_url: null, api_url: "",
api_json: null, api_json: "",
api_json_record: null, api_json_record: "",
cid_root: null, blog: "",
uri_root: null, cid_root: "",
uri_root: "",
comment_open: false, comment_open: false,
comment_first: null, comment_first: "",
loading: true, loading: true,
avatar_url: "", avatar_url: "",
f: null, f: "",
url_check: true, url_check: true,
url: "/", url: "/",
products: [...Array(Number(page)).keys()], products: [...Array(Number(page)).keys()],
@ -92,11 +96,13 @@ export default {
} }
}, },
mounted() { mounted() {
if (window.location.host === "localhost:8080") { if (this.host === "localhost:8080") {
this.host = "manga.syui.ai";
this.api_url = "/api/"; 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"; 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/"; this.api_url = "/api/";
} else { } else {
if (location.protocol !== "https:") { if (location.protocol !== "https:") {
@ -109,9 +115,12 @@ export default {
.get(url,{ crossdomain: true }) .get(url,{ crossdomain: true })
.then( .then(
response => {this.api_json = response response => {this.api_json = response
this.cid_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc).cid; const tmp = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc);
this.uri_root = this.api_json.data.find((v) => v.blog_url == 'https://' + v.blog + loc).uri; if (tmp !== undefined) {
this.api_json_record = this.api_json.data.filter((v) => v.cid_root == this.cid_root); 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({ new Vue({
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#comment')