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,22 +1,24 @@
<template> <template>
<div id="app"> <div id="comment">
<div class="loading" v-if="loading && cid_root"> <div class="comment-root">
<vue-loading type="cylon" color="#fff700" :size="{ width: '50px', height: '50px' }"></vue-loading> <div class="loading" v-if="loading && cid_root">
</div> <vue-loading type="cylon" color="#fff700" :size="{ width: '50px', height: '50px' }"></vue-loading>
<div class="loading_none" v-else> </div>
</div> <div class="loading_none" v-else>
<div class="bsky_comment" v-if="cid_root"> </div>
<span v-for="(i,index) in api_json_record" class="comment"> <div class="bsky_comment" v-if="cid_root">
<p class="comment-body" v-if="i.cid_root == cid_root"> <span v-for="(i,index) in api_json_record" class="comment">
<span v-if="i.did.replace('did:plc:', '') != ''"> <p class="comment-body" v-if="i.cid_root == cid_root">
<img src="/icon/null.jpg" v-if="loading" class="comment" > <span v-if="i.did.replace('did:plc:', '') != ''">
<img :src="'https://git.syui.ai/ai/comment/raw/branch/main/public/icon/' + i.did.replace('did:plc:', '') + '.jpg'" class="comment" @load="load" v-if="api_json_record.length - 1 == index"> <img src="/icon/null.jpg" v-if="loading" class="comment" >
<img :src="'https://git.syui.ai/ai/comment/raw/branch/main/public/icon/' + i.did.replace('did:plc:', '') + '.jpg'" class="comment" v-else> <img :src="'https://git.syui.ai/ai/comment/raw/branch/main/public/icon/' + i.did.replace('did:plc:', '') + '.jpg'" class="comment" @load="load" v-if="api_json_record.length - 1 == index">
</span> <img :src="'https://git.syui.ai/ai/comment/raw/branch/main/public/icon/' + i.did.replace('did:plc:', '') + '.jpg'" class="comment" v-else>
<span class="comment-time" v-if="i.updated_at && !loading"><a :href="i.bsky_url" v-if="i.bsky_url">{{ moment(i.updated_at) }}</a></span> <span class="comment-handle" v-if="i.handle && !loading"><a :href="'https://' + i.bsky_url.split('/').slice(2,5).join('/')" v-if="i.bsky_url">@{{ i.handle.replace('.bsky.social', '') }}</a></span> </span>
<span class="comment-text" v-if="i.text && !loading">{{ i.text }}</span> <span class="comment-time" v-if="i.updated_at && !loading"><a :href="i.bsky_url" v-if="i.bsky_url">{{ moment(i.updated_at) }}</a></span> <span class="comment-handle" v-if="i.handle && !loading"><a :href="'https://' + i.bsky_url.split('/').slice(2,5).join('/')" v-if="i.bsky_url">@{{ i.handle.replace('.bsky.social', '') }}</a></span>
</p> <span class="comment-text" v-if="i.text && !loading">{{ i.text }}</span>
</span> </p>
</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -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,28 +96,33 @@ 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:") {
location.replace("https:" + location.href.substring(location.protocol.length)); 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);
} }
); 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);
}
}
);
} }
}; };
</script> </script>

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')