fix #62
This commit is contained in:
1 parent
8d6135a8fb
commit
b61ce6bdae
3 files changed
+33
-2
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "0.4.22",
|
"version": "0.4.23",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import { DEFAULT_INSTANCE_URL, getClient, instance } from '$lib/lemmy.js'
|
import { DEFAULT_INSTANCE_URL, getClient, instance } from '$lib/lemmy.js'
|
||||||
import type { MyUserInfo } from 'lemmy-js-client'
|
import type { MyUserInfo } from 'lemmy-js-client'
|
||||||
@@ -190,3 +191,33 @@ export function setUserID(id: number) {
|
|||||||
|
|
||||||
return prof
|
return prof
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
if (!get(profile)) return
|
||||||
|
|
||||||
|
const { user, jwt } = get(profile)!
|
||||||
|
if (!jwt || !user) return
|
||||||
|
|
||||||
|
const response = await getClient().getUnreadCount({
|
||||||
|
auth: jwt,
|
||||||
|
})
|
||||||
|
|
||||||
|
user.unreads =
|
||||||
|
response.mentions + response.private_messages + response.replies
|
||||||
|
|
||||||
|
if (amModOfAny(user)) {
|
||||||
|
const reports = await getClient().getReportCount({
|
||||||
|
auth: jwt,
|
||||||
|
})
|
||||||
|
|
||||||
|
user.reports =
|
||||||
|
reports.comment_reports +
|
||||||
|
reports.post_reports +
|
||||||
|
(reports.private_message_reports ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.update((p) => ({
|
||||||
|
...p!,
|
||||||
|
user: user,
|
||||||
|
}))
|
||||||
|
}, 30 * 1000)
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { build, files } from '$service-worker'
|
import { build, files } from '$service-worker'
|
||||||
|
|
||||||
const version = '0.4.22'
|
const version = '0.4.23'
|
||||||
const timestamp = new Date().toLocaleString('en')
|
const timestamp = new Date().toLocaleString('en')
|
||||||
const worker = self as unknown as ServiceWorkerGlobalScope
|
const worker = self as unknown as ServiceWorkerGlobalScope
|
||||||
const FILES = `cache${timestamp}`
|
const FILES = `cache${timestamp}`
|
||||||
|
|||||||
Reference in new issue
Block a user