fix path
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
<!-- OAuth Comment System - Load globally for session management -->
|
||||
<script type="module" crossorigin src="/assets/comment-atproto-C3utAhPv.js"></script>
|
||||
<script type="module" crossorigin src="/assets/comment-atproto-BxIEgp9a.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/comment-atproto-BH-72ESb.css">
|
@@ -1,3 +1,3 @@
|
||||
<!-- OAuth Comment System - Load globally for session management -->
|
||||
<script type="module" crossorigin src="/assets/comment-atproto-C3utAhPv.js"></script>
|
||||
<script type="module" crossorigin src="/assets/comment-atproto-BxIEgp9a.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/comment-atproto-BH-72ESb.css">
|
@@ -302,13 +302,13 @@ function App() {
|
||||
const langData = await langResponse.json();
|
||||
const langRecords = langData.records || [];
|
||||
|
||||
// Filter by current page path if on post page
|
||||
// Filter by current page rkey if on post page
|
||||
const filteredLangRecords = appConfig.rkey
|
||||
? langRecords.filter(record => {
|
||||
// Compare path only, not full URL to support localhost vs production
|
||||
const recordPath = record.value.post?.url ? new URL(record.value.post.url).pathname :
|
||||
record.value.url ? new URL(record.value.url).pathname : '';
|
||||
return recordPath === window.location.pathname;
|
||||
// Compare rkey only (last part of path)
|
||||
const recordRkey = record.value.post?.url ? new URL(record.value.post.url).pathname.split('/').pop() : '';
|
||||
const currentRkey = window.location.pathname.split('/').pop();
|
||||
return recordRkey === currentRkey;
|
||||
})
|
||||
: langRecords.slice(0, 3); // Top page: latest 3
|
||||
|
||||
@@ -321,13 +321,13 @@ function App() {
|
||||
const commentData = await commentResponse.json();
|
||||
const commentRecords = commentData.records || [];
|
||||
|
||||
// Filter by current page path if on post page
|
||||
// Filter by current page rkey if on post page
|
||||
const filteredCommentRecords = appConfig.rkey
|
||||
? commentRecords.filter(record => {
|
||||
// Compare path only, not full URL to support localhost vs production
|
||||
const recordPath = record.value.post?.url ? new URL(record.value.post.url).pathname :
|
||||
record.value.url ? new URL(record.value.url).pathname : '';
|
||||
return recordPath === window.location.pathname;
|
||||
// Compare rkey only (last part of path)
|
||||
const recordRkey = record.value.post?.url ? new URL(record.value.post.url).pathname.split('/').pop() : '';
|
||||
const currentRkey = window.location.pathname.split('/').pop();
|
||||
return recordRkey === currentRkey;
|
||||
})
|
||||
: commentRecords.slice(0, 3); // Top page: latest 3
|
||||
|
||||
|
Reference in New Issue
Block a user