refactor: rewrite client api adapters to be more efficient (#714)

* refactor: switch LemmyClient to a proxy to remove boilerplate methods

* refactor: make piefed adaptor (adapter?) declarative

* refactor: clean up rewrite.ts in Piefed adapter and fix type errors

* refactor: split auth.svelte.ts -> auth/profile.svelte.ts + auth/inbox.svelte.ts

* cleanup: $lib/feature/comment

* cleanup: remove useless 'transforms' src/lib/api/piefed/adapter.ts
This commit is contained in:
xylight authored and GitHub committed 2026-02-08 19:48:16 +00:00
commit 2a5fb886ae
105 files changed
+1135 -1724

No files matched your search

+6 -8
View File
@@ -1,4 +1,4 @@
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { DEFAULT_INSTANCE_URL } from '$lib/app/instance.svelte' import { DEFAULT_INSTANCE_URL } from '$lib/app/instance.svelte'
import { instanceToURL } from '$lib/app/util.svelte' import { instanceToURL } from '$lib/app/util.svelte'
import { error } from '@sveltejs/kit' import { error } from '@sveltejs/kit'
@@ -80,13 +80,11 @@ export function client({
// but not here, so that if jwt == '', it doesnt put a bearer // but not here, so that if jwt == '', it doesnt put a bearer
const headers = jwt ? { authorization: `Bearer ${jwt}` } : {} const headers = jwt ? { authorization: `Bearer ${jwt}` } : {}
return new (clientType.name == 'piefed' ? PiefedClient : LemmyClient)( const Client = clientType.name == 'piefed' ? PiefedClient : LemmyClient
instanceToURL(instanceURL), return new Client(instanceToURL(instanceURL), {
{ fetchFunction: (input, init) => customFetch(func, input, init, jwt),
fetchFunction: (input, init) => customFetch(func, input, init, jwt), headers: headers,
headers: headers, }) as unknown as BaseClient
},
)
} }
// here for parts where i forgor to switch // here for parts where i forgor to switch
+67 -479
View File
@@ -2,12 +2,68 @@ import { LemmyHttp } from 'lemmy-js-client'
import type { BaseClient, ClientType } from '../base' import type { BaseClient, ClientType } from '../base'
import { fromGetPosts, toListingType } from './rewrite' import { fromGetPosts, toListingType } from './rewrite'
export class LemmyClient implements BaseClient { export const LemmyClientConstants = {
type: ClientType = { name: 'lemmy', baseUrl: '/api/v3' } password: { minLength: 8, maxLength: 60 },
}
static constants = { password: { minLength: 8, maxLength: 60 } } export function createLemmyClient(
baseUrl: string,
args: {
fetchFunction: (input: any, init: any) => Promise<any>
headers: any
},
): BaseClient {
const client = new LemmyHttp(baseUrl, args)
#client: LemmyHttp const overrides: Partial<BaseClient> = {
type: { name: 'lemmy', baseUrl: '/api/v3' } as ClientType,
async search(params) {
return await client.search({
...params,
listing_type: toListingType(params.listing_type),
} as any)
},
async listCommunities(params) {
return await client.listCommunities({
...params,
type_: toListingType(params.type_),
} as any)
},
async getPosts(params) {
return (await client.getPosts(fromGetPosts(params) as any)) as any
},
async getComments(params) {
return await client.getComments({
...params,
type_: toListingType(params.type_),
} as any)
},
}
return new Proxy(overrides as BaseClient, {
get: (target, prop, receiver) => {
const value = Reflect.get(target, prop, receiver)
if (value !== undefined) {
return value
}
const clientValue = (client as any)[prop]
if (typeof clientValue === 'function') {
return clientValue.bind(client)
}
return clientValue
},
})
}
export class LemmyClient {
static constants = LemmyClientConstants
#proxy: BaseClient
constructor( constructor(
baseUrl: string, baseUrl: string,
@@ -16,481 +72,13 @@ export class LemmyClient implements BaseClient {
headers: any headers: any
}, },
) { ) {
this.#client = new LemmyHttp(baseUrl, args) this.#proxy = createLemmyClient(baseUrl, args)
}
async getSite( return new Proxy(this, {
...params: Parameters<BaseClient['getSite']> get: (target, prop) => {
): ReturnType<BaseClient['getSite']> { if (prop === 'constructor') return LemmyClient
return await this.#client.getSite(...params) return (target.#proxy as any)[prop]
} },
async generateTotpSecret( }) as any
...params: Parameters<BaseClient['generateTotpSecret']>
): ReturnType<BaseClient['generateTotpSecret']> {
return await this.#client.generateTotpSecret(...params)
}
async listLogins(
...params: Parameters<BaseClient['listLogins']>
): ReturnType<BaseClient['listLogins']> {
return await this.#client.listLogins(...params)
}
async listAllMedia(
...params: Parameters<BaseClient['listAllMedia']>
): ReturnType<BaseClient['listAllMedia']> {
return await this.#client.listAllMedia(...params)
}
async updateTotp(
...params: Parameters<BaseClient['updateTotp']>
): ReturnType<BaseClient['updateTotp']> {
return await this.#client.updateTotp(...params)
}
async getModlog(
...params: Parameters<BaseClient['getModlog']>
): ReturnType<BaseClient['getModlog']> {
return await this.#client.getModlog(...params)
}
async search(
params: Parameters<BaseClient['search']>[0],
): ReturnType<BaseClient['search']> {
return await this.#client.search({
...params,
listing_type: toListingType(params.listing_type),
})
}
async resolveObject(
...params: Parameters<BaseClient['resolveObject']>
): ReturnType<BaseClient['resolveObject']> {
return await this.#client.resolveObject(...params)
}
async createCommunity(
...params: Parameters<BaseClient['createCommunity']>
): ReturnType<BaseClient['createCommunity']> {
return await this.#client.createCommunity(...params)
}
async getCommunity(
...params: Parameters<BaseClient['getCommunity']>
): ReturnType<BaseClient['getCommunity']> {
return await this.#client.getCommunity(...params)
}
async editCommunity(
...params: Parameters<BaseClient['editCommunity']>
): ReturnType<BaseClient['editCommunity']> {
return await this.#client.editCommunity(...params)
}
async listCommunities(
params: Parameters<BaseClient['listCommunities']>[0],
): ReturnType<BaseClient['listCommunities']> {
return await this.#client.listCommunities({
...params,
type_: toListingType(params.type_),
})
}
async followCommunity(
...params: Parameters<BaseClient['followCommunity']>
): ReturnType<BaseClient['followCommunity']> {
return await this.#client.followCommunity(...params)
}
async blockCommunity(
...params: Parameters<BaseClient['blockCommunity']>
): ReturnType<BaseClient['blockCommunity']> {
return await this.#client.blockCommunity(...params)
}
async deleteCommunity(
...params: Parameters<BaseClient['deleteCommunity']>
): ReturnType<BaseClient['deleteCommunity']> {
return await this.#client.deleteCommunity(...params)
}
async hideCommunity(
...params: Parameters<BaseClient['hideCommunity']>
): ReturnType<BaseClient['hideCommunity']> {
return await this.#client.hideCommunity(...params)
}
async removeCommunity(
...params: Parameters<BaseClient['removeCommunity']>
): ReturnType<BaseClient['removeCommunity']> {
return await this.#client.removeCommunity(...params)
}
async banFromCommunity(
...params: Parameters<BaseClient['banFromCommunity']>
): ReturnType<BaseClient['banFromCommunity']> {
return await this.#client.banFromCommunity(...params)
}
async addModToCommunity(
...params: Parameters<BaseClient['addModToCommunity']>
): ReturnType<BaseClient['addModToCommunity']> {
return await this.#client.addModToCommunity(...params)
}
async createPost(
...params: Parameters<BaseClient['createPost']>
): ReturnType<BaseClient['createPost']> {
return await this.#client.createPost(...params)
}
async getPost(
...params: Parameters<BaseClient['getPost']>
): ReturnType<BaseClient['getPost']> {
return await this.#client.getPost(...params)
}
async editPost(
...params: Parameters<BaseClient['editPost']>
): ReturnType<BaseClient['editPost']> {
return await this.#client.editPost(...params)
}
async deletePost(
...params: Parameters<BaseClient['deletePost']>
): ReturnType<BaseClient['deletePost']> {
return await this.#client.deletePost(...params)
}
async removePost(
...params: Parameters<BaseClient['removePost']>
): ReturnType<BaseClient['removePost']> {
return await this.#client.removePost(...params)
}
async markPostAsRead(
...params: Parameters<BaseClient['markPostAsRead']>
): ReturnType<BaseClient['markPostAsRead']> {
return await this.#client.markPostAsRead(...params)
}
async hidePost(
...params: Parameters<BaseClient['hidePost']>
): ReturnType<BaseClient['hidePost']> {
return await this.#client.hidePost(...params)
}
async lockPost(
...params: Parameters<BaseClient['lockPost']>
): ReturnType<BaseClient['lockPost']> {
return await this.#client.lockPost(...params)
}
async featurePost(
...params: Parameters<BaseClient['featurePost']>
): ReturnType<BaseClient['featurePost']> {
return await this.#client.featurePost(...params)
}
async getPosts(
params: Parameters<BaseClient['getPosts']>[0],
): ReturnType<BaseClient['getPosts']> {
return await this.#client.getPosts(fromGetPosts(params))
}
async likePost(
...params: Parameters<BaseClient['likePost']>
): ReturnType<BaseClient['likePost']> {
return await this.#client.likePost(...params)
}
async listPostLikes(
...params: Parameters<BaseClient['listPostLikes']>
): ReturnType<BaseClient['listPostLikes']> {
return await this.#client.listPostLikes(...params)
}
async savePost(
...params: Parameters<BaseClient['savePost']>
): ReturnType<BaseClient['savePost']> {
return await this.#client.savePost(...params)
}
async createPostReport(
...params: Parameters<BaseClient['createPostReport']>
): ReturnType<BaseClient['createPostReport']> {
return await this.#client.createPostReport(...params)
}
async resolvePostReport(
...params: Parameters<BaseClient['resolvePostReport']>
): ReturnType<BaseClient['resolvePostReport']> {
return await this.#client.resolvePostReport(...params)
}
async listPostReports(
...params: Parameters<BaseClient['listPostReports']>
): ReturnType<BaseClient['listPostReports']> {
return await this.#client.listPostReports(...params)
}
async getSiteMetadata(
...params: Parameters<BaseClient['getSiteMetadata']>
): ReturnType<BaseClient['getSiteMetadata']> {
return await this.#client.getSiteMetadata(...params)
}
async createComment(
...params: Parameters<BaseClient['createComment']>
): ReturnType<BaseClient['createComment']> {
return await this.#client.createComment(...params)
}
async editComment(
...params: Parameters<BaseClient['editComment']>
): ReturnType<BaseClient['editComment']> {
return await this.#client.editComment(...params)
}
async deleteComment(
...params: Parameters<BaseClient['deleteComment']>
): ReturnType<BaseClient['deleteComment']> {
return await this.#client.deleteComment(...params)
}
async removeComment(
...params: Parameters<BaseClient['removeComment']>
): ReturnType<BaseClient['removeComment']> {
return await this.#client.removeComment(...params)
}
async markCommentReplyAsRead(
...params: Parameters<BaseClient['markCommentReplyAsRead']>
): ReturnType<BaseClient['markCommentReplyAsRead']> {
return await this.#client.markCommentReplyAsRead(...params)
}
async likeComment(
...params: Parameters<BaseClient['likeComment']>
): ReturnType<BaseClient['likeComment']> {
return await this.#client.likeComment(...params)
}
async listCommentLikes(
...params: Parameters<BaseClient['listCommentLikes']>
): ReturnType<BaseClient['listCommentLikes']> {
return await this.#client.listCommentLikes(...params)
}
async saveComment(
...params: Parameters<BaseClient['saveComment']>
): ReturnType<BaseClient['saveComment']> {
return await this.#client.saveComment(...params)
}
async distinguishComment(
...params: Parameters<BaseClient['distinguishComment']>
): ReturnType<BaseClient['distinguishComment']> {
return await this.#client.distinguishComment(...params)
}
async getComments(
params: Parameters<BaseClient['getComments']>[0],
): ReturnType<BaseClient['getComments']> {
return await this.#client.getComments({
...params,
type_: toListingType(params.type_),
})
}
async getComment(
...params: Parameters<BaseClient['getComment']>
): ReturnType<BaseClient['getComment']> {
return await this.#client.getComment(...params)
}
async createCommentReport(
...params: Parameters<BaseClient['createCommentReport']>
): ReturnType<BaseClient['createCommentReport']> {
return await this.#client.createCommentReport(...params)
}
async resolveCommentReport(
...params: Parameters<BaseClient['resolveCommentReport']>
): ReturnType<BaseClient['resolveCommentReport']> {
return await this.#client.resolveCommentReport(...params)
}
async listCommentReports(
...params: Parameters<BaseClient['listCommentReports']>
): ReturnType<BaseClient['listCommentReports']> {
return await this.#client.listCommentReports(...params)
}
async getPrivateMessages(
...params: Parameters<BaseClient['getPrivateMessages']>
): ReturnType<BaseClient['getPrivateMessages']> {
return await this.#client.getPrivateMessages(...params)
}
async createPrivateMessage(
...params: Parameters<BaseClient['createPrivateMessage']>
): ReturnType<BaseClient['createPrivateMessage']> {
return await this.#client.createPrivateMessage(...params)
}
async editPrivateMessage(
...params: Parameters<BaseClient['editPrivateMessage']>
): ReturnType<BaseClient['editPrivateMessage']> {
return await this.#client.editPrivateMessage(...params)
}
async deletePrivateMessage(
...params: Parameters<BaseClient['deletePrivateMessage']>
): ReturnType<BaseClient['deletePrivateMessage']> {
return await this.#client.deletePrivateMessage(...params)
}
async markPrivateMessageAsRead(
...params: Parameters<BaseClient['markPrivateMessageAsRead']>
): ReturnType<BaseClient['markPrivateMessageAsRead']> {
return await this.#client.markPrivateMessageAsRead(...params)
}
async createPrivateMessageReport(
...params: Parameters<BaseClient['createPrivateMessageReport']>
): ReturnType<BaseClient['createPrivateMessageReport']> {
return await this.#client.createPrivateMessageReport(...params)
}
async resolvePrivateMessageReport(
...params: Parameters<BaseClient['resolvePrivateMessageReport']>
): ReturnType<BaseClient['resolvePrivateMessageReport']> {
return await this.#client.resolvePrivateMessageReport(...params)
}
async listPrivateMessageReports(
...params: Parameters<BaseClient['listPrivateMessageReports']>
): ReturnType<BaseClient['listPrivateMessageReports']> {
return await this.#client.listPrivateMessageReports(...params)
}
async register(
...params: Parameters<BaseClient['register']>
): ReturnType<BaseClient['register']> {
return await this.#client.register(...params)
}
async login(
...params: Parameters<BaseClient['login']>
): ReturnType<BaseClient['login']> {
return await this.#client.login(...params)
}
async logout(
...params: Parameters<BaseClient['logout']>
): ReturnType<BaseClient['logout']> {
return await this.#client.logout(...params)
}
async getPersonDetails(
...params: Parameters<BaseClient['getPersonDetails']>
): ReturnType<BaseClient['getPersonDetails']> {
return await this.#client.getPersonDetails(...params)
}
async getPersonMentions(
...params: Parameters<BaseClient['getPersonMentions']>
): ReturnType<BaseClient['getPersonMentions']> {
return await this.#client.getPersonMentions(...params)
}
async markPersonMentionAsRead(
...params: Parameters<BaseClient['markPersonMentionAsRead']>
): ReturnType<BaseClient['markPersonMentionAsRead']> {
return await this.#client.markPersonMentionAsRead(...params)
}
async getReplies(
...params: Parameters<BaseClient['getReplies']>
): ReturnType<BaseClient['getReplies']> {
return await this.#client.getReplies(...params)
}
async banPerson(
...params: Parameters<BaseClient['banPerson']>
): ReturnType<BaseClient['banPerson']> {
return await this.#client.banPerson(...params)
}
async getBannedPersons(
...params: Parameters<BaseClient['getBannedPersons']>
): ReturnType<BaseClient['getBannedPersons']> {
return await this.#client.getBannedPersons(...params)
}
async blockPerson(
...params: Parameters<BaseClient['blockPerson']>
): ReturnType<BaseClient['blockPerson']> {
return await this.#client.blockPerson(...params)
}
async getCaptcha(
...params: Parameters<BaseClient['getCaptcha']>
): ReturnType<BaseClient['getCaptcha']> {
return await this.#client.getCaptcha(...params)
}
async deleteAccount(
...params: Parameters<BaseClient['deleteAccount']>
): ReturnType<BaseClient['deleteAccount']> {
return await this.#client.deleteAccount(...params)
}
async passwordReset(
...params: Parameters<BaseClient['passwordReset']>
): ReturnType<BaseClient['passwordReset']> {
return await this.#client.passwordReset(...params)
}
async passwordChangeAfterReset(
...params: Parameters<BaseClient['passwordChangeAfterReset']>
): ReturnType<BaseClient['passwordChangeAfterReset']> {
return await this.#client.passwordChangeAfterReset(...params)
}
async markAllAsRead(
...params: Parameters<BaseClient['markAllAsRead']>
): ReturnType<BaseClient['markAllAsRead']> {
return await this.#client.markAllAsRead(...params)
}
async saveUserSettings(
...params: Parameters<BaseClient['saveUserSettings']>
): ReturnType<BaseClient['saveUserSettings']> {
return await this.#client.saveUserSettings(...params)
}
async changePassword(
...params: Parameters<BaseClient['changePassword']>
): ReturnType<BaseClient['changePassword']> {
return await this.#client.changePassword(...params)
}
async getReportCount(
...params: Parameters<BaseClient['getReportCount']>
): ReturnType<BaseClient['getReportCount']> {
return await this.#client.getReportCount(...params)
}
async getUnreadCount(
...params: Parameters<BaseClient['getUnreadCount']>
): ReturnType<BaseClient['getUnreadCount']> {
return await this.#client.getUnreadCount(...params)
}
async verifyEmail(
...params: Parameters<BaseClient['verifyEmail']>
): ReturnType<BaseClient['verifyEmail']> {
return await this.#client.verifyEmail(...params)
}
async addAdmin(
...params: Parameters<BaseClient['addAdmin']>
): ReturnType<BaseClient['addAdmin']> {
return await this.#client.addAdmin(...params)
}
async getUnreadRegistrationApplicationCount(
...params: Parameters<BaseClient['getUnreadRegistrationApplicationCount']>
): ReturnType<BaseClient['getUnreadRegistrationApplicationCount']> {
return await this.#client.getUnreadRegistrationApplicationCount(...params)
}
async listRegistrationApplications(
...params: Parameters<BaseClient['listRegistrationApplications']>
): ReturnType<BaseClient['listRegistrationApplications']> {
return await this.#client.listRegistrationApplications(...params)
}
async approveRegistrationApplication(
...params: Parameters<BaseClient['approveRegistrationApplication']>
): ReturnType<BaseClient['approveRegistrationApplication']> {
return await this.#client.approveRegistrationApplication(...params)
}
async getRegistrationApplication(
...params: Parameters<BaseClient['getRegistrationApplication']>
): ReturnType<BaseClient['getRegistrationApplication']> {
return await this.#client.getRegistrationApplication(...params)
}
async purgePerson(
...params: Parameters<BaseClient['purgePerson']>
): ReturnType<BaseClient['purgePerson']> {
return await this.#client.purgePerson(...params)
}
async purgeCommunity(
...params: Parameters<BaseClient['purgeCommunity']>
): ReturnType<BaseClient['purgeCommunity']> {
return await this.#client.purgeCommunity(...params)
}
async purgePost(
...params: Parameters<BaseClient['purgePost']>
): ReturnType<BaseClient['purgePost']> {
return await this.#client.purgePost(...params)
}
async purgeComment(
...params: Parameters<BaseClient['purgeComment']>
): ReturnType<BaseClient['purgeComment']> {
return await this.#client.purgeComment(...params)
}
async getFederatedInstances(
...params: Parameters<BaseClient['getFederatedInstances']>
): ReturnType<BaseClient['getFederatedInstances']> {
return await this.#client.getFederatedInstances(...params)
}
async blockInstance(
...params: Parameters<BaseClient['blockInstance']>
): ReturnType<BaseClient['blockInstance']> {
return await this.#client.blockInstance(...params)
}
async uploadImage(
...params: Parameters<BaseClient['uploadImage']>
): ReturnType<BaseClient['uploadImage']> {
return await this.#client.uploadImage(...params)
}
async editSite(
...params: Parameters<BaseClient['editSite']>
): ReturnType<BaseClient['editSite']> {
return await this.#client.editSite(...params)
}
async deleteImage(
...params: Parameters<BaseClient['deleteImage']>
): ReturnType<BaseClient['deleteImage']> {
return await this.#client.deleteImage(...params)
}
async listMedia(
...params: Parameters<BaseClient['listMedia']>
): ReturnType<BaseClient['listMedia']> {
return await this.#client.listMedia(...params)
} }
} }
File diff suppressed because it is too large. Load diff
+65 -85
View File
@@ -1,36 +1,23 @@
import { Search } from 'mono-svelte' import * as base from '../types'
import type { import type { components, paths } from './schema'
Comment,
CommentReplyView, type Schema<T extends keyof components['schemas']> = components['schemas'][T]
CommentSortType,
CommentView, type PathQuery<P extends keyof paths> = paths[P] extends {
Community, get: { parameters: { query?: infer Q } }
CommunityView, }
CreateComment, ? Q
CreatePost, : never
FeedView,
GetComments, type PathBody<P extends keyof paths> = paths[P] extends {
GetPost, post: { requestBody: { content: { 'application/json': infer B } } }
GetPosts, }
GetReplies, ? B
ListCommunities, : never
LocalSite,
MyUserInfo,
Person,
PersonMentionView,
PersonView,
Post,
PostView,
PrivateMessageView,
SortType,
SubscribedType,
TopicView,
} from '../types'
import type { components } from './schema'
export function toPersonView( export function toPersonView(
personView: components['schemas']['PersonView'], personView: Schema<'PersonView'>,
): PersonView { ): base.PersonView {
return { return {
counts: personView.counts, counts: personView.counts,
is_admin: personView.is_admin, is_admin: personView.is_admin,
@@ -38,7 +25,7 @@ export function toPersonView(
} }
} }
export function toPerson(person: components['schemas']['Person']): Person { export function toPerson(person: Schema<'Person'>): base.Person {
return { return {
...person, ...person,
id: person.id, id: person.id,
@@ -47,14 +34,14 @@ export function toPerson(person: components['schemas']['Person']): Person {
} }
} }
export function toLocalSite(site: components['schemas']['Site']): LocalSite { export function toLocalSite(site: Schema<'Site'>): base.LocalSite {
if (site) return {} if (site) return {}
return {} return {}
} }
export function toCommunityView( export function toCommunityView(
communityView: components['schemas']['CommunityView'], communityView: Schema<'CommunityView'>,
): CommunityView { ): base.CommunityView {
return { return {
...communityView, ...communityView,
community: toCommunity(communityView.community), community: toCommunity(communityView.community),
@@ -74,9 +61,7 @@ export function toCommunityView(
} }
} }
export function toCommunity( export function toCommunity(community: Schema<'Community'>): base.Community {
community: components['schemas']['Community'],
): Community {
return { return {
...community, ...community,
posting_restricted_to_mods: false, posting_restricted_to_mods: false,
@@ -84,9 +69,7 @@ export function toCommunity(
} }
} }
export function toMyUser( export function toMyUser(myUser: Schema<'MyUserInfo'>): base.MyUserInfo {
myUser: components['schemas']['MyUserInfo'],
): MyUserInfo {
return { return {
...myUser, ...myUser,
community_blocks: myUser.community_blocks.map((i) => ({ community_blocks: myUser.community_blocks.map((i) => ({
@@ -125,9 +108,7 @@ export function toMyUser(
} }
} }
export function toPostView( export function toPostView(postView: Schema<'PostView'>): base.PostView {
postView: components['schemas']['PostView'],
): PostView {
return { return {
...postView, ...postView,
creator: toPerson(postView.creator), creator: toPerson(postView.creator),
@@ -137,7 +118,7 @@ export function toPostView(
} }
} }
export function toPost(post: components['schemas']['Post']): Post { export function toPost(post: Schema<'Post'>): base.Post {
return { return {
...post, ...post,
creator_id: -1, creator_id: -1,
@@ -148,19 +129,19 @@ export function toPost(post: components['schemas']['Post']): Post {
} }
export function toCommentView( export function toCommentView(
commentView: components['schemas']['CommentView'], commentView: Schema<'CommentView'>,
): CommentView { ): base.CommentView {
return { return {
...commentView, ...commentView,
comment: toComment(commentView.comment), comment: toComment(commentView.comment),
creator: toPerson(commentView.creator), creator: toPerson(commentView.creator),
post: toPost(commentView.post), post: toPost(commentView.post),
community: toCommunity(commentView.community), community: toCommunity(commentView.community),
subscribed: commentView.subscribed as SubscribedType, subscribed: commentView.subscribed as base.SubscribedType,
} }
} }
export function toComment(comment: components['schemas']['Comment']): Comment { export function toComment(comment: Schema<'Comment'>): base.Comment {
return { return {
...comment, ...comment,
content: comment.body, content: comment.body,
@@ -170,8 +151,8 @@ export function toComment(comment: components['schemas']['Comment']): Comment {
} }
export function toCommentReplyView( export function toCommentReplyView(
commentReplyView: components['schemas']['CommentReplyView'], commentReplyView: Schema<'CommentReplyView'>,
): CommentReplyView { ): base.CommentReplyView {
return { return {
...commentReplyView, ...commentReplyView,
banned_from_community: false, banned_from_community: false,
@@ -185,8 +166,8 @@ export function toCommentReplyView(
} }
export function toPrivateMessageView( export function toPrivateMessageView(
privateMessageView: components['schemas']['PrivateMessageView'], privateMessageView: Schema<'PrivateMessageView'>,
): PrivateMessageView { ): base.PrivateMessageView {
return { return {
...privateMessageView, ...privateMessageView,
creator: toPerson(privateMessageView.creator), creator: toPerson(privateMessageView.creator),
@@ -195,8 +176,8 @@ export function toPrivateMessageView(
} }
export function toPersonMentionView( export function toPersonMentionView(
personMentionView: components['schemas']['CommentReplyView'], personMentionView: Schema<'CommentReplyView'>,
): PersonMentionView { ): base.PersonMentionView {
return { return {
...personMentionView, ...personMentionView,
person_mention: personMentionView.comment_reply, person_mention: personMentionView.comment_reply,
@@ -210,9 +191,7 @@ export function toPersonMentionView(
} }
} }
export function toTopicView( export function toTopicView(topicView: Schema<'TopicView'>): base.TopicView {
topicView: components['schemas']['TopicView'],
): TopicView {
return { return {
...topicView, ...topicView,
communities: topicView.communities?.map(toCommunity), communities: topicView.communities?.map(toCommunity),
@@ -220,9 +199,7 @@ export function toTopicView(
} }
} }
export function toFeedView( export function toFeedView(feedView: Schema<'FeedView'>): base.FeedView {
feedView: components['schemas']['FeedView'],
): FeedView {
return { return {
...feedView, ...feedView,
communities: feedView.communities?.map(toCommunity), communities: feedView.communities?.map(toCommunity),
@@ -230,10 +207,9 @@ export function toFeedView(
} }
} }
// Query calls
export function fromGetPosts( export function fromGetPosts(
getPosts: GetPosts, getPosts: base.GetPosts,
): components['parameters']['GetPosts'] { ): PathQuery<'/api/alpha/post/list'> {
return { return {
...getPosts, ...getPosts,
sort: toSortType(getPosts.sort), sort: toSortType(getPosts.sort),
@@ -242,8 +218,8 @@ export function fromGetPosts(
} }
export function fromGetComments( export function fromGetComments(
getComments: GetComments, getComments: base.GetComments,
): components['schemas']['GetComments'] { ): PathQuery<'/api/alpha/comment/list'> {
return { return {
...getComments, ...getComments,
sort: toCommentSortType(getComments.sort), sort: toCommentSortType(getComments.sort),
@@ -251,23 +227,25 @@ export function fromGetComments(
} }
export function fromGetPost( export function fromGetPost(
getPost: GetPost, getPost: base.GetPost,
): components['schemas']['GetPost'] { ): PathQuery<'/api/alpha/post'> {
return getPost return getPost
} }
export function fromGetReplies( export function fromGetReplies(
getReplies: GetReplies, getReplies: base.GetReplies,
): components['schemas']['GetReplies'] { ): PathQuery<'/api/alpha/user/replies'> {
return { return {
...getReplies, ...getReplies,
sort: toCommentSortType(getReplies.sort), sort: toCommentSortType(getReplies.sort),
} }
} }
export function fromSearch(search: Search): components['schemas']['Search'] { export function fromSearch(
search: base.Search,
): PathQuery<'/api/alpha/search'> {
return { return {
...(search as Omit<Search, 'type_'> & { ...(search as Omit<base.Search, 'type_'> & {
type_: 'Communities' | 'Users' | 'Url' | 'Posts' type_: 'Communities' | 'Users' | 'Url' | 'Posts'
}), }),
sort: toSortType(search.sort), sort: toSortType(search.sort),
@@ -275,8 +253,8 @@ export function fromSearch(search: Search): components['schemas']['Search'] {
} }
export function fromCreatePost( export function fromCreatePost(
createPost: CreatePost, createPost: base.CreatePost,
): components['schemas']['CreatePost'] { ): PathBody<'/api/alpha/post'> {
return { return {
...createPost, ...createPost,
title: createPost.name, title: createPost.name,
@@ -284,27 +262,28 @@ export function fromCreatePost(
} }
export function fromListCommunities( export function fromListCommunities(
listCommunities: ListCommunities, listCommunities: base.ListCommunities,
): components['schemas']['CommunityRequest'] { ): PathQuery<'/api/alpha/community/list'> {
return { return {
...listCommunities, ...listCommunities,
type_: listCommunities.type_ as 'All',
sort: toCommunitiesSortType(listCommunities.sort), sort: toCommunitiesSortType(listCommunities.sort),
} }
} }
export function fromCreateComment( export function fromCreateComment(
createComment: CreateComment, createComment: base.CreateComment,
): components['schemas']['CreateComment'] { ): PathBody<'/api/alpha/comment'> {
return { return {
...createComment, ...createComment,
body: createComment.content, body: createComment.content,
} }
} }
// Misc
export function toSortType( export function toSortType(
sortType?: SortType, sortType?: base.SortType,
): components['schemas']['SortType'] | undefined { ): Schema<'SortType'> | undefined {
if (!sortType) return
if ( if (
sortType == 'Old' || sortType == 'Old' ||
sortType == 'MostComments' || sortType == 'MostComments' ||
@@ -312,18 +291,19 @@ export function toSortType(
sortType == 'NewComments' sortType == 'NewComments'
) )
sortType = 'New' sortType = 'New'
return sortType if (sortType?.startsWith('Top')) sortType = 'TopAll'
return sortType as Schema<'SortType'>
} }
export function toCommentSortType( export function toCommentSortType(
commentSortType?: CommentSortType, commentSortType?: base.CommentSortType,
): components['schemas']['CommentSortType'] | undefined { ): Schema<'CommentSortType'> | undefined {
if (commentSortType == 'Controversial') commentSortType = undefined if (commentSortType == 'Controversial') commentSortType = undefined
return commentSortType return commentSortType
} }
export function toCommunitiesSortType( export function toCommunitiesSortType(
sortType?: SortType, sortType?: base.SortType,
): 'Top' | 'Hot' | 'New' | undefined { ): 'Top' | 'Hot' | 'New' | undefined {
if (sortType == 'Hot' || sortType == 'New' || sortType == undefined) if (sortType == 'Hot' || sortType == 'New' || sortType == undefined)
return sortType return sortType
+6 -4
View File
@@ -4706,7 +4706,7 @@ export interface components {
* Format: datetime * Format: datetime
* @example 2025-06-07T02:29:07.980084Z * @example 2025-06-07T02:29:07.980084Z
*/ */
published?: string published: string
title?: string title?: string
} }
PersonView: { PersonView: {
@@ -5809,7 +5809,7 @@ export interface components {
note: string note: string
} }
UserSetNoteResponse: { UserSetNoteResponse: {
person_view?: components['schemas']['PersonView'] person_view: components['schemas']['PersonView']
} }
ListCommentsResponse: { ListCommentsResponse: {
comments: components['schemas']['CommentView'][] comments: components['schemas']['CommentView'][]
@@ -5873,7 +5873,7 @@ export interface components {
id: number id: number
creator_id: number creator_id: number
comment_id: number comment_id: number
original_comment_text?: string original_comment_text: string
reason?: string reason?: string
resolved: boolean resolved: boolean
/** /**
@@ -6057,7 +6057,7 @@ export interface components {
* Format: datetime * Format: datetime
* @example 2025-06-07T02:29:07.980084Z * @example 2025-06-07T02:29:07.980084Z
*/ */
published?: string published: string
} }
PostReportView: { PostReportView: {
post_report: components['schemas']['PostReport'] post_report: components['schemas']['PostReport']
@@ -6215,6 +6215,8 @@ export interface components {
private_message_id: number private_message_id: number
reason: string reason: string
} }
SortType: 'Active' | 'Hot' | 'TopAll' | 'New' | 'Old'
CommentSortType: 'Hot' | 'Top' | 'TopAll' | 'New' | 'Old'
} }
responses: { responses: {
/** @description Unprocessable Content */ /** @description Unprocessable Content */
+4 -4
View File
@@ -165,7 +165,7 @@ export interface GetPersonMentionsResponse {
} }
export interface GetPost { export interface GetPost {
id?: PostId id: PostId
comment_id?: CommentId comment_id?: CommentId
} }
@@ -190,8 +190,8 @@ export interface GetPosts {
show_read?: boolean show_read?: boolean
show_nsfw?: boolean show_nsfw?: boolean
page_cursor?: PaginationCursor page_cursor?: PaginationCursor
feed_id?: string feed_id?: number
topic_id?: string topic_id?: number
} }
export interface GetPostsResponse { export interface GetPostsResponse {
@@ -2333,7 +2333,7 @@ export interface UpdateTotpResponse {
} }
export interface UploadImage { export interface UploadImage {
image: File | Buffer image: File
} }
export interface UploadImageResponse { export interface UploadImageResponse {
msg: string msg: string
+90
View File
@@ -0,0 +1,90 @@
import type { Profile } from './profile.svelte'
interface Notifications {
inbox: number
reports: number
applications: number
}
export class InboxService {
private readonly POLL_INTERVAL = 4 * 60 * 1000
#pollInterval: ReturnType<typeof setInterval> | null = null
#profile: Profile
notifications = $state<Notifications>({
applications: 0,
inbox: 0,
reports: 0,
})
constructor(profile: Profile) {
this.#profile = profile
}
async init(): Promise<void> {
this.cleanup()
this.notifications = await this.checkInbox()
this.#pollInterval = setInterval(async () => {
this.notifications = await this.checkInbox()
}, this.POLL_INTERVAL)
}
cleanup(): void {
if (this.#pollInterval) clearInterval(this.#pollInterval)
this.#pollInterval = null
}
clear(): Notifications {
this.notifications = {
applications: 0,
inbox: 0,
reports: 0,
}
return this.notifications
}
async checkInbox(): Promise<Notifications> {
if (!this.#profile.current.user || !this.#profile.current.jwt)
return this.clear()
const unreadsPromise = this.#profile.client
.getUnreadCount()
.then((res) => res.mentions + res.private_messages + res.replies)
.catch(() => 0)
const reportsPromise = this.#profile.isMod()
? this.#profile.client
.getReportCount({})
.then(
(res) =>
res.comment_reports +
res.post_reports +
(res.private_message_reports ?? 0),
)
.catch(() => 0)
: Promise.resolve(0)
const applicationsPromise = this.#profile.isAdmin
? this.#profile.client
.getUnreadRegistrationApplicationCount()
.then((res) => res.registration_applications)
.catch(() => 0)
: Promise.resolve(0)
const [unreads, reports, applications] = await Promise.all([
unreadsPromise,
reportsPromise,
applicationsPromise,
])
return {
inbox: unreads,
reports: reports,
applications: applications,
}
}
}
+1
View File
@@ -0,0 +1 @@
export { profile, type ProfileInfo } from './profile.svelte'
@@ -5,10 +5,11 @@ import { client, site } from '$lib/api/client.svelte'
import type { Community, GetSiteResponse, MyUserInfo } from '$lib/api/types' import type { Community, GetSiteResponse, MyUserInfo } from '$lib/api/types'
import { publishedToDate } from '$lib/ui/util/date' import { publishedToDate } from '$lib/ui/util/date'
import { toast } from 'mono-svelte' import { toast } from 'mono-svelte'
import { errorMessage } from './error' import { errorMessage } from '../error'
import { t } from './i18n' import { t } from '../i18n'
import { DEFAULT_INSTANCE_URL } from './instance.svelte' import { DEFAULT_INSTANCE_URL } from '../instance.svelte'
import { instanceToURL, moveItem } from './util.svelte' import { instanceToURL, moveItem } from '../util.svelte'
import { InboxService } from './inbox.svelte'
function getFromStorage<T>(key: string): T | undefined { function getFromStorage<T>(key: string): T | undefined {
if (!browser) return if (!browser) return
@@ -18,9 +19,12 @@ function getFromStorage<T>(key: string): T | undefined {
return JSON.parse(lc) return JSON.parse(lc)
} }
function setFromStorage(key: string, item: any, stringify: boolean = true) { function setFromStorage<T>(key: string, item: T, stringify: boolean = true) {
if (!browser) return if (!browser) return
return localStorage.setItem(key, stringify ? JSON.stringify(item) : item) return localStorage.setItem(
key,
stringify ? JSON.stringify(item) : (item as string),
)
} }
export interface ProfileInfo { export interface ProfileInfo {
@@ -44,12 +48,6 @@ interface ProfileData {
profile: number profile: number
} }
interface Notifications {
inbox: number
reports: number
applications: number
}
const getCookie = (key: string): string | undefined => { const getCookie = (key: string): string | undefined => {
if (!browser) return undefined if (!browser) return undefined
@@ -60,7 +58,7 @@ const getCookie = (key: string): string | undefined => {
?.split('=')?.[1] ?.split('=')?.[1]
} }
class Profile { export class Profile {
private static readonly DONATION_CHECK_TIMEOUT = 3 * 1000 private static readonly DONATION_CHECK_TIMEOUT = 3 * 1000
private static readonly DONATION_REMINDER_INTERVAL = 375 * 24 * 60 * 60 * 1000 private static readonly DONATION_REMINDER_INTERVAL = 375 * 24 * 60 * 60 * 1000
@@ -142,11 +140,10 @@ class Profile {
private donationPoll(delay: number) { private donationPoll(delay: number) {
return setTimeout(() => { return setTimeout(() => {
if ( if (
profile.current.user?.local_user_view.local_user this.current.user?.local_user_view.local_user.last_donation_notification
.last_donation_notification
) { ) {
const donationDate = publishedToDate( const donationDate = publishedToDate(
profile.current.user?.local_user_view.local_user this.current.user?.local_user_view.local_user
.last_donation_notification, .last_donation_notification,
) )
if ( if (
@@ -161,11 +158,11 @@ class Profile {
// lemmy js client donation dialog is broken // lemmy js client donation dialog is broken
fetch( fetch(
`${instanceToURL(profile.current.instance)}/api/v3/user/donation_dialog_shown`, `${instanceToURL(this.current.instance)}/api/v3/user/donation_dialog_shown`,
{ {
method: 'POST', method: 'POST',
headers: { headers: {
authorization: `Bearer ${profile.current.jwt}`, authorization: `Bearer ${this.current.jwt}`,
}, },
}, },
) )
@@ -179,7 +176,7 @@ class Profile {
if (this.#current.jwt) { if (this.#current.jwt) {
site.data = undefined site.data = undefined
const res = await userFromJwt( const res = await fetchUserContext(
this.#current.jwt, this.#current.jwt,
this.#current.instance, this.#current.instance,
this.#current.client, this.#current.client,
@@ -199,7 +196,7 @@ class Profile {
site.data = res?.site site.data = res?.site
this.#current.user = res?.user this.#current.user = res?.user
if (profile.current.user) { if (this.current.user) {
this.#current.avatar = res?.user?.local_user_view.person.avatar this.#current.avatar = res?.user?.local_user_view.person.avatar
this.#current.username = res?.user?.local_user_view.person.name this.#current.username = res?.user?.local_user_view.person.name
} }
@@ -218,7 +215,7 @@ class Profile {
async add(jwt: string, instance: string, type: ClientType) { async add(jwt: string, instance: string, type: ClientType) {
try { try {
const user = await userFromJwt(jwt, instance, type) const user = await fetchUserContext(jwt, instance, type)
if (!user?.user) { if (!user?.user) {
throw new Error('No user data received') throw new Error('No user data received')
} }
@@ -265,15 +262,13 @@ class Profile {
} }
isMod(community?: Community): boolean { isMod(community?: Community): boolean {
if (community) if (!community) return (this.#current.user?.moderates.length ?? 0) > 0
return ( if (community.local && this.isAdmin) return true
(this.#current.user?.moderates.some( return (
(i) => i.community.id == community.id, this.#current.user?.moderates.some(
) || (m) => m.community.id === community.id,
(community.local && this.isAdmin)) ?? ) ?? false
false )
)
else return (this.#current.user?.moderates.length ?? 0) > 0
} }
get isAdmin(): boolean { get isAdmin(): boolean {
@@ -311,93 +306,9 @@ class Profile {
}) })
} }
class InboxService {
private readonly POLL_INTERVAL = 4 * 60 * 1000
#pollInterval: NodeJS.Timeout | null = null
#profile: Profile
notifications = $state<Notifications>({
applications: 0,
inbox: 0,
reports: 0,
})
constructor(profile: Profile) {
this.#profile = profile
}
async init(): Promise<void> {
this.cleanup()
this.notifications = await this.checkInbox()
this.#pollInterval = setInterval(async () => {
this.notifications = await this.checkInbox()
}, this.POLL_INTERVAL)
}
cleanup(): void {
if (this.#pollInterval) clearInterval(this.#pollInterval)
this.#pollInterval = null
}
clear(): Notifications {
this.notifications = {
applications: 0,
inbox: 0,
reports: 0,
}
return this.notifications
}
async checkInbox(): Promise<Notifications> {
if (!this.#profile.current.user || !this.#profile.current.jwt)
return this.clear()
const unreadsPromise = client()
.getUnreadCount()
.then((res) => res.mentions + res.private_messages + res.replies)
.catch(() => 0)
const reportsPromise = this.#profile.isMod()
? client()
.getReportCount({})
.then(
(res) =>
res.comment_reports +
res.post_reports +
(res.private_message_reports ?? 0),
)
.catch(() => 0)
: new Promise<number>((res) => res(0))
const applicationsPromise = this.#profile.isAdmin
? client()
.getUnreadRegistrationApplicationCount()
.then((res) => res.registration_applications)
.catch(() => 0)
: new Promise<number>((res) => res(0))
const [unreads, reports, applications] = await Promise.all([
unreadsPromise,
reportsPromise,
applicationsPromise,
])
return {
inbox: unreads,
reports: reports,
applications: applications,
}
}
}
export const profile = new Profile() export const profile = new Profile()
// this is all garbage legacy code, remove later async function fetchUserContext(
async function userFromJwt(
jwt: string, jwt: string,
instance: string, instance: string,
type: ClientType, type: ClientType,
@@ -429,10 +340,8 @@ async function userFromJwt(
if (!site) return if (!site) return
const myUser = site.my_user
return { return {
user: myUser, user: site.my_user,
site: site, site: site,
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { env } from '$env/dynamic/public' import { env } from '$env/dynamic/public'
import { profile } from './auth.svelte' import { profile } from './auth'
class InstanceData { class InstanceData {
#instance = $derived(profile.current.instance) #instance = $derived(profile.current.instance)
+9 -6
View File
@@ -1,5 +1,6 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { env } from '$env/dynamic/public'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { Community, Person } from '$lib/api/types' import type { Community, Person } from '$lib/api/types'
import { SvelteURL } from 'svelte/reactivity' import { SvelteURL } from 'svelte/reactivity'
@@ -26,6 +27,7 @@ export const searchParam = (
}) })
} }
// why is this using SvelteURL brother
export const fullCommunityName = (name: string, actorId: string) => export const fullCommunityName = (name: string, actorId: string) =>
`${name}@${new SvelteURL(actorId).hostname}` `${name}@${new SvelteURL(actorId).hostname}`
@@ -33,8 +35,8 @@ export const placeholders = {
get: (type: 'url' | 'post' | 'body' | 'comment') => { get: (type: 'url' | 'post' | 'body' | 'comment') => {
switch (type) { switch (type) {
case 'post': case 'post':
return Math.random() < 0.01 return Math.random() < 0.01 && env.PUBLIC_XYLIGHT_MODE
? 'A C E C* B* G D E E F G F E D C E' ? 'top 10 reasons why TCP is brilliant and UDP is a spawn of satan'
: t.get('placeholders.title') : t.get('placeholders.title')
case 'body': case 'body':
return t.get('placeholders.body') return t.get('placeholders.body')
@@ -46,6 +48,8 @@ export const placeholders = {
}, },
} }
// lol this function was made 3 years ago when lil xylight
// was still learning cs
export function moveItem<T>( export function moveItem<T>(
array: T[], array: T[],
currentIndex: number, currentIndex: number,
@@ -62,10 +66,7 @@ export function moveItem<T>(
const newArray = [...array] const newArray = [...array]
// Remove the item from the current index
const [item] = newArray.splice(currentIndex, 1) const [item] = newArray.splice(currentIndex, 1)
// Insert the item at the new index
newArray.splice(newIndex, 0, item) newArray.splice(newIndex, 0, item)
return newArray return newArray
@@ -139,7 +140,6 @@ export function fuzzySearch(text: string, pattern: string): number {
lastIndex = index lastIndex = index
} }
// Bonus for matching start of words
if (textLower.startsWith(patternLower)) { if (textLower.startsWith(patternLower)) {
score += 2 score += 2
} else if (textLower.includes(' ' + patternLower)) { } else if (textLower.includes(' ' + patternLower)) {
@@ -167,6 +167,9 @@ export function snapshot<T>(item: T) {
return $state.snapshot(item) return $state.snapshot(item)
} }
// these methods should really not exist
// instead we should use lemmy's url_content_type which
// gives us a mimetype (which is more reliable)
export const isImage = (url: string | undefined) => { export const isImage = (url: string | undefined) => {
try { try {
if (!url) return false if (!url) return false
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { CommentView } from '$lib/api/types' import type { CommentView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { Button, Menu, MenuButton } from 'mono-svelte' import { Button, Menu, MenuButton } from 'mono-svelte'
+2 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client, site } from '$lib/api/client.svelte' import { client, site } from '$lib/api/client.svelte'
import type { CommentResponse } from '$lib/api/types' import type { CommentResponse } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
@@ -68,6 +68,7 @@
content: value, content: value,
post_id: postId, post_id: postId,
parent_id: parentId, parent_id: parentId,
language_id: language,
}) })
oncomment?.(response) oncomment?.(response)
+1 -6
View File
@@ -28,11 +28,7 @@
}: Props = $props() }: Props = $props()
</script> </script>
<div <div class={['flex flex-col flex-1 rounded-none list-none', clazz]}>
class={['flex flex-col flex-1 rounded-none list-none', clazz]}
color="none"
padding="none"
>
{#if meta} {#if meta}
<div class="flex flex-row justify-between items-center gap-2"> <div class="flex flex-row justify-between items-center gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
@@ -68,7 +64,6 @@
</div> </div>
{/if} {/if}
<Comment <Comment
postId={comment.post.id}
node={{ children: [], comment_view: comment, depth: 1, expanded: true }} node={{ children: [], comment_view: comment, depth: 1, expanded: true }}
replying={false} replying={false}
{meta} {meta}
@@ -18,8 +18,6 @@
let { nodes = $bindable(), post }: Props = $props() let { nodes = $bindable(), post }: Props = $props()
let childrenPage = 0
async function fetchChildren(parent: CommentNodeI) { async function fetchChildren(parent: CommentNodeI) {
if ( if (
!( !(
@@ -37,7 +35,6 @@
max_depth: 5, max_depth: 5,
parent_id: parent.comment_view.comment.id, parent_id: parent.comment_view.comment.id,
type_: 'All', type_: 'All',
page: childrenPage,
}) })
if (newComments.comments.length == 0) { if (newComments.comments.length == 0) {
@@ -52,7 +49,6 @@
newComments.comments, newComments.comments,
parent.depth, parent.depth,
)[0].children )[0].children
childrenPage++
} catch (err) { } catch (err) {
console.error(err) console.error(err)
toast({ toast({
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import type { Comment } from '$lib/api/types' import type { Comment } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
@@ -1,7 +1,7 @@
<script lang="ts" module> <script lang="ts" module>
import { client, getClient } from '$lib/api/client.svelte' import { client, getClient } from '$lib/api/client.svelte'
import type { CommunityModeratorView, CommunityView } from '$lib/api/types' import type { CommunityModeratorView, CommunityView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { client, site } from '$lib/api/client.svelte' import { client, site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
@@ -6,7 +6,7 @@
CommunityModeratorView, CommunityModeratorView,
SubscribedType, SubscribedType,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { fullCommunityName, userLink } from '$lib/app/util.svelte' import { fullCommunityName, userLink } from '$lib/app/util.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { CommunityView } from '$lib/api/types' import type { CommunityView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { locale, t } from '$lib/app/i18n' import { locale, t } from '$lib/app/i18n'
import { fullCommunityName } from '$lib/app/util.svelte' import { fullCommunityName } from '$lib/app/util.svelte'
import CommonItem from '$lib/ui/layout/CommonItem.svelte' import CommonItem from '$lib/ui/layout/CommonItem.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { CommunityView } from '$lib/api/types' import type { CommunityView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { communityLink } from '$lib/app/util.svelte' import { communityLink } from '$lib/app/util.svelte'
import Avatar from '$lib/ui/generic/Avatar.svelte' import Avatar from '$lib/ui/generic/Avatar.svelte'
+1 -1
View File
@@ -15,7 +15,7 @@ import type {
SortType, SortType,
TopicView, TopicView,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { recursiveEqual } from '$lib/app/util.svelte' import { recursiveEqual } from '$lib/app/util.svelte'
import { SvelteMap } from 'svelte/reactivity' import { SvelteMap } from 'svelte/reactivity'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { searchParam } from '$lib/app/util.svelte' import { searchParam } from '$lib/app/util.svelte'
import { Option, Select } from 'mono-svelte' import { Option, Select } from 'mono-svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { searchParam } from '$lib/app/util.svelte' import { searchParam } from '$lib/app/util.svelte'
import { Option, Select } from 'mono-svelte' import { Option, Select } from 'mono-svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { PrivateMessageView } from '$lib/api/types' import type { PrivateMessageView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
import UserLink from '../user/UserLink.svelte' import UserLink from '../user/UserLink.svelte'
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { type ProfileInfo } from '$lib/app/auth.svelte.js' import { type ProfileInfo } from '$lib/app/auth'
import Avatar from '$lib/ui/generic/Avatar.svelte' import Avatar from '$lib/ui/generic/Avatar.svelte'
interface Props { interface Props {
+1 -1
View File
@@ -11,7 +11,7 @@ import type {
PrivateMessageReportView, PrivateMessageReportView,
PrivateMessageView, PrivateMessageView,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import type { Post } from '../post' import type { Post } from '../post'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { Community, Person } from '$lib/api/types' import type { Community, Person } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { CommentView } from '$lib/api/types' import type { CommentView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Menu, MenuButton, MenuDivider } from 'mono-svelte' import { Menu, MenuButton, MenuDivider } from 'mono-svelte'
import type { Snippet } from 'svelte' import type { Snippet } from 'svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import type { CommentView, PostView } from '$lib/api/types' import type { CommentView, PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte' import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import type { CommentView, PostView } from '$lib/api/types' import type { CommentView, PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
@@ -5,7 +5,7 @@
PostView, PostView,
PrivateMessageView, PrivateMessageView,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { PostView } from '$lib/api/types' import type { PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { type View, settings } from '$lib/app/settings.svelte' import { type View, settings } from '$lib/app/settings.svelte'
import { publishedToDate } from '$lib/ui/util/date' import { publishedToDate } from '$lib/ui/util/date'
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts" module> <script lang="ts" module>
import type { Community, Person, SubscribedType } from '$lib/api/types' import type { Community, Person, SubscribedType } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
import { type View, settings } from '$lib/app/settings.svelte' import { type View, settings } from '$lib/app/settings.svelte'
+1 -1
View File
@@ -18,7 +18,7 @@
<script lang="ts"> <script lang="ts">
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import type { Post } from '$lib/api/types' import type { Post } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import type { PostView } from '$lib/api/types' import type { PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import { settings, type View } from '$lib/app/settings.svelte' import { settings, type View } from '$lib/app/settings.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import type { PostView } from '$lib/api/types' import type { PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { deleteItem, markAsRead } from '$lib/feature/legacy/contentview' import { deleteItem, markAsRead } from '$lib/feature/legacy/contentview'
+1 -1
View File
@@ -2,7 +2,7 @@
import { client, site } from '$lib/api/client.svelte' import { client, site } from '$lib/api/client.svelte'
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import type { PostView } from '$lib/api/types' import type { PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
import { env } from '$env/dynamic/public' import { env } from '$env/dynamic/public'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { CommentView, PersonView, Post } from '$lib/api/types' import type { CommentView, PersonView, Post } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { import {
canParseUrl, canParseUrl,
findClosestNumber, findClosestNumber,
+1 -1
View File
@@ -2,7 +2,7 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import type { Post, PostPoll } from '$lib/api/types' import type { Post, PostPoll } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { CommonList } from '$lib/ui/layout' import { CommonList } from '$lib/ui/layout'
+11 -7
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { LocalImage, Person } from '$lib/api/types' import type { LocalImage, Person } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { instanceToURL } from '$lib/app/util.svelte' import { instanceToURL } from '$lib/app/util.svelte'
import { showImage } from '$lib/ui/generic/ExpandableImage.svelte' import { showImage } from '$lib/ui/generic/ExpandableImage.svelte'
@@ -42,14 +42,16 @@
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
{#snippet img()} {#snippet img()}
<button <button
onclick={ onclick={() =>
() => showImage(
showImage(`${instanceToURL(profile.current.instance)}/pictrs/image/${image.pictrs_alias}`) `${instanceToURL(profile.current.instance)}/pictrs/image/${image.pictrs_alias}`,
} )}
class="cursor-pointer" class="cursor-pointer"
> >
<img <img
src="{instanceToURL(profile.current.instance)}/pictrs/image/{image.pictrs_alias}" src="{instanceToURL(
profile.current.instance,
)}/pictrs/image/{image.pictrs_alias}"
width="500" width="500"
height="500" height="500"
class="aspect-square w-full h-full object-cover rounded-xl" class="aspect-square w-full h-full object-cover rounded-xl"
@@ -70,7 +72,9 @@
/> />
<Button <Button
title={$t('routes.profile.media.download')} title={$t('routes.profile.media.download')}
href="{instanceToURL(profile.current.instance)}/pictrs/image/{image.pictrs_alias}" href="{instanceToURL(
profile.current.instance,
)}/pictrs/image/{image.pictrs_alias}"
size="square-md" size="square-md"
class="ml-auto" class="ml-auto"
icon={ArrowDownTray} icon={ArrowDownTray}
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { profile, type ProfileInfo } from '$lib/app/auth.svelte' import { profile, type ProfileInfo } from '$lib/app/auth'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import SidebarButton from '$lib/ui/sidebar/SidebarButton.svelte' import SidebarButton from '$lib/ui/sidebar/SidebarButton.svelte'
import { Icon, QuestionMarkCircle } from 'svelte-hero-icons/dist' import { Icon, QuestionMarkCircle } from 'svelte-hero-icons/dist'
+1 -1
View File
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { DEFAULT_CLIENT_TYPE } from '$lib/api/base' import { DEFAULT_CLIENT_TYPE } from '$lib/api/base'
import { profile, type ProfileInfo } from '$lib/app/auth.svelte' import { profile, type ProfileInfo } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import Avatar from '$lib/ui/generic/Avatar.svelte' import Avatar from '$lib/ui/generic/Avatar.svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import type { ListingType, Person } from '$lib/api/types' import type { ListingType, Person } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import Avatar from '$lib/ui/generic/Avatar.svelte' import Avatar from '$lib/ui/generic/Avatar.svelte'
import { MenuButton, Search } from 'mono-svelte' import { MenuButton, Search } from 'mono-svelte'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { Community, MyUserInfo } from '$lib/api/types' import type { Community, MyUserInfo } from '$lib/api/types'
import { profile, type ProfileInfo } from '$lib/app/auth.svelte' import { profile, type ProfileInfo } from '$lib/app/auth'
// TODO obliterate this file // TODO obliterate this file
export async function blockUser(block: boolean, id: number) { export async function blockUser(block: boolean, id: number) {
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { uploadImage } from '$lib/app/util.svelte' import { uploadImage } from '$lib/app/util.svelte'
-2
View File
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { invalidateAll } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import TabButton from '$lib/ui/form/TabButton.svelte' import TabButton from '$lib/ui/form/TabButton.svelte'
import { SvelteURL } from 'svelte/reactivity' import { SvelteURL } from 'svelte/reactivity'
@@ -70,7 +69,6 @@
)} )}
{#if style == 'header'} {#if style == 'header'}
<a <a
onclick={() => invalidateAll()}
href={buildUrl(currentRoute, route.href)} href={buildUrl(currentRoute, route.href)}
class={['tab-item ', selected && 'tab-selected']} class={['tab-item ', selected && 'tab-selected']}
> >
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import { Menu, Spinner } from 'mono-svelte' import { Menu, Spinner } from 'mono-svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { env } from '$env/dynamic/public' import { env } from '$env/dynamic/public'
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { theme } from '$lib/app/theme/theme.svelte' import { theme } from '$lib/app/theme/theme.svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { theme } from '$lib/app/theme/theme.svelte' import { theme } from '$lib/app/theme/theme.svelte'
import { fuzzySearch } from '$lib/app/util.svelte' import { fuzzySearch } from '$lib/app/util.svelte'
+1 -4
View File
@@ -1,9 +1,6 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { import { profile as currentProfile, type ProfileInfo } from '$lib/app/auth'
profile as currentProfile,
type ProfileInfo,
} from '$lib/app/auth.svelte'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { theme, type ThemeData } from '$lib/app/theme/theme.svelte' import { theme, type ThemeData } from '$lib/app/theme/theme.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { env } from '$env/dynamic/public' import { env } from '$env/dynamic/public'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
+1 -3
View File
@@ -24,9 +24,7 @@
}: Props = $props() }: Props = $props()
let selected = $derived( let selected = $derived(
page.url.pathname.startsWith( page.url.pathname.startsWith(href ?? '2026-02-08 hey guyz') ?? false,
href ?? 'The power of fluffy boys shines within you.',
) ?? false,
) )
</script> </script>
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { DEFAULT_CLIENT_TYPE } from '$lib/api/base' import { DEFAULT_CLIENT_TYPE } from '$lib/api/base'
import { type ProfileInfo, profile } from '$lib/app/auth.svelte' import { type ProfileInfo, profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { import {
DEFAULT_INSTANCE_URL, DEFAULT_INSTANCE_URL,
@@ -1,5 +1,5 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { error, redirect } from '@sveltejs/kit' import { error, redirect } from '@sveltejs/kit'
export const ssr = false export const ssr = false
+1 -1
View File
@@ -1,5 +1,5 @@
<script> <script>
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Tabs } from '$lib/ui/layout' import { Tabs } from '$lib/ui/layout'
import { Badge } from 'mono-svelte' import { Badge } from 'mono-svelte'
+1 -1
View File
@@ -1,5 +1,5 @@
import { getClient, site } from '$lib/api/client.svelte' import { getClient, site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { error } from '@sveltejs/kit' import { error } from '@sveltejs/kit'
export async function load({ fetch }) { export async function load({ fetch }) {
@@ -4,7 +4,7 @@
ApproveRegistrationApplication, ApproveRegistrationApplication,
RegistrationApplicationView, RegistrationApplicationView,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import ApplicationDenyModal from '$lib/feature/moderation/ApplicationDenyModal.svelte' import ApplicationDenyModal from '$lib/feature/moderation/ApplicationDenyModal.svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client, site } from '$lib/api/client.svelte' import { client, site } from '$lib/api/client.svelte'
import type { EditSite } from '$lib/api/types' import type { EditSite } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { client, getClient } from '$lib/api/client.svelte' import { client, getClient } from '$lib/api/client.svelte'
import type { Instance } from '$lib/api/types' import type { Instance } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Placeholder from '$lib/ui/info/Placeholder.svelte' import Placeholder from '$lib/ui/info/Placeholder.svelte'
+1 -1
View File
@@ -1,5 +1,5 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { ReactiveState } from '$lib/app/util.svelte' import { ReactiveState } from '$lib/app/util.svelte'
export async function load({ fetch, url }) { export async function load({ fetch, url }) {
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import type { Tagline } from '$lib/api/types' import type { Tagline } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte' import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { navigating, page } from '$app/state' import { navigating, page } from '$app/state'
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { setSessionStorage } from '$lib/app/session' import { setSessionStorage } from '$lib/app/session'
import CommunityHeader from '$lib/feature/community/CommunityHeader.svelte' import CommunityHeader from '$lib/feature/community/CommunityHeader.svelte'
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte' import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export async function load({ params, fetch }) { export async function load({ params, fetch }) {
@@ -3,7 +3,7 @@
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import { page } from '$app/state' import { page } from '$app/state'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import ProfileButton from '$lib/feature/user/ProfileButton.svelte' import ProfileButton from '$lib/feature/user/ProfileButton.svelte'
@@ -1,4 +1,4 @@
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export async function load({ params }) { export async function load({ params }) {
+1 -1
View File
@@ -5,7 +5,7 @@
CommunityView, CommunityView,
SubscribedType, SubscribedType,
} from '$lib/api/types' } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { toast } from 'mono-svelte' import { toast } from 'mono-svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { site } from '$lib/api/client.svelte' import { site } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Header, Tabs } from '$lib/ui/layout' import { Header, Tabs } from '$lib/ui/layout'
+1 -1
View File
@@ -1,4 +1,4 @@
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export const load = () => { export const load = () => {
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import Location from '$lib/feature/filter/Location.svelte' import Location from '$lib/feature/filter/Location.svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { searchParam } from '$lib/app/util.svelte' import { searchParam } from '$lib/app/util.svelte'
import Fixate from '$lib/ui/generic/Fixate.svelte' import Fixate from '$lib/ui/generic/Fixate.svelte'
+1 -1
View File
@@ -1,5 +1,5 @@
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { ReactiveState } from '$lib/app/util.svelte' import { ReactiveState } from '$lib/app/util.svelte'
import { import {
generalizeCommentReply, generalizeCommentReply,
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
import { escapeHtml } from '$lib/app/util.svelte' import { escapeHtml } from '$lib/app/util.svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import type { Person, PrivateMessageView } from '$lib/api/types' import type { Person, PrivateMessageView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte' import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
import Avatar from '$lib/ui/generic/Avatar.svelte' import Avatar from '$lib/ui/generic/Avatar.svelte'
@@ -2,7 +2,7 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import type { PrivateMessageResponse } from '$lib/api/types' import type { PrivateMessageResponse } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
+2 -3
View File
@@ -9,7 +9,7 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { LemmyClient } from '$lib/api/lemmy/adapter' import { LemmyClient } from '$lib/api/lemmy/adapter'
import { PiefedClient } from '$lib/api/piefed/adapter' import { PiefedClient } from '$lib/api/piefed/adapter'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { import {
@@ -75,8 +75,7 @@
// leading HTTPS is redundant // leading HTTPS is redundant
form.instance = form.instance.trim().replace(/^https:\/\//, '') form.instance = form.instance.trim().replace(/^https:\/\//, '')
if (!LINKED_INSTANCE_URL) if (!LINKED_INSTANCE_URL) await checkInstance()
await checkInstance()
const response = await client({ const response = await client({
instanceURL: form.instance, instanceURL: form.instance,
+1 -1
View File
@@ -6,7 +6,7 @@
type ClientType, type ClientType,
DEFAULT_CLIENT_TYPE, DEFAULT_CLIENT_TYPE,
} from '$lib/api/base' } from '$lib/api/base'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { getClient, validateInstance } from '$lib/api/client.svelte' import { getClient, validateInstance } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { import {
+1 -1
View File
@@ -1,4 +1,4 @@
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { error } from '@sveltejs/kit' import { error } from '@sveltejs/kit'
export function load() { export function load() {
+1 -1
View File
@@ -1,5 +1,5 @@
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { ReactiveState } from '$lib/app/util.svelte' import { ReactiveState } from '$lib/app/util.svelte'
import { isCommentView, isPostView } from '$lib/feature/legacy/item' import { isCommentView, isPostView } from '$lib/feature/legacy/item'
import { import {
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { getClient } from '$lib/api/client.svelte' import { getClient } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import CommentItem from '$lib/feature/comment/CommentItem.svelte' import CommentItem from '$lib/feature/comment/CommentItem.svelte'
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import CommunityItem from '$lib/feature/community/CommunityItem.svelte' import CommunityItem from '$lib/feature/community/CommunityItem.svelte'
import { CommonList, Header } from '$lib/ui/layout' import { CommonList, Header } from '$lib/ui/layout'
+1 -1
View File
@@ -2,7 +2,7 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { page } from '$app/state' import { page } from '$app/state'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { searchParam } from '$lib/app/util.svelte' import { searchParam } from '$lib/app/util.svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { getClient, validateInstance } from '$lib/api/client.svelte' import { getClient, validateInstance } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { error, redirect } from '@sveltejs/kit' import { error, redirect } from '@sveltejs/kit'
export function load({ params }) { export function load({ params }) {
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte' import Markdown from '$lib/app/markdown/Markdown.svelte'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
@@ -1,10 +1,15 @@
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import { ReactiveState } from '$lib/app/util.svelte' import { ReactiveState } from '$lib/app/util.svelte'
import CommunityCard from '$lib/feature/community/CommunityCard.svelte' import CommunityCard from '$lib/feature/community/CommunityCard.svelte'
import { Feed, feed, feeds, type FeedTypes } from '$lib/feature/feeds/feed.svelte' import {
Feed,
feed,
feeds,
type FeedTypes,
} from '$lib/feature/feeds/feed.svelte'
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
function buildContext(thread?: string) { function buildContext(thread?: string) {
@@ -29,10 +34,17 @@ function buildContext(thread?: string) {
async function findInFeed(id: '/' | '/c/[name]' | '/f/[id]', postId: string) { async function findInFeed(id: '/' | '/c/[name]' | '/f/[id]', postId: string) {
// this never actually loads anything // this never actually loads anything
if (id == '/') { if (id == '/') {
return (feeds.get(id) as Feed<FeedTypes['/'][0], FeedTypes['/'][1]>)?.peek() return (feeds.get(id) as Feed<FeedTypes['/'][0], FeedTypes['/'][1]>)
?.peek()
?.posts.find((i) => i.post.id.toString() == postId) ?.posts.find((i) => i.post.id.toString() == postId)
} else { } else {
return (feeds.get(id) as Feed<FeedTypes['/c/[name]'][0], FeedTypes['/c/[name]'][1]>)?.peek() return (
feeds.get(id) as Feed<
FeedTypes['/c/[name]'][0],
FeedTypes['/c/[name]'][1]
>
)
?.peek()
?.posts.find((i) => i.post.id.toString() == postId) ?.posts.find((i) => i.post.id.toString() == postId)
} }
} }
@@ -2,7 +2,7 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { page } from '$app/state' import { page } from '$app/state'
import type { CommentSortType, CommentView, PostView } from '$lib/api/types' import type { CommentSortType, CommentView, PostView } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { settings } from '$lib/app/settings.svelte' import { settings } from '$lib/app/settings.svelte'
import CommentForm from '$lib/feature/comment/CommentForm.svelte' import CommentForm from '$lib/feature/comment/CommentForm.svelte'
@@ -3,7 +3,7 @@
import { resolveRoute } from '$app/paths' import { resolveRoute } from '$app/paths'
import { page } from '$app/state' import { page } from '$app/state'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import ProfileButton from '$lib/feature/user/ProfileButton.svelte' import ProfileButton from '$lib/feature/user/ProfileButton.svelte'
@@ -1,4 +1,4 @@
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
export async function load({ params }) { export async function load({ params }) {
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { communityLink } from '$lib/app/util.svelte.js' import { communityLink } from '$lib/app/util.svelte.js'
import ItemList from '$lib/ui/generic/ItemList.svelte' import ItemList from '$lib/ui/generic/ItemList.svelte'
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import ItemList from '$lib/ui/generic/ItemList.svelte' import ItemList from '$lib/ui/generic/ItemList.svelte'
import Placeholder from '$lib/ui/info/Placeholder.svelte' import Placeholder from '$lib/ui/info/Placeholder.svelte'
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { userLink } from '$lib/app/util.svelte.js' import { userLink } from '$lib/app/util.svelte.js'
import ItemList from '$lib/ui/generic/ItemList.svelte' import ItemList from '$lib/ui/generic/ItemList.svelte'
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { errorMessage } from '$lib/app/error' import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Button, TextInput, toast } from 'mono-svelte' import { Button, TextInput, toast } from 'mono-svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { Button, removeToast, Switch, TextInput, toast } from 'mono-svelte' import { Button, removeToast, Switch, TextInput, toast } from 'mono-svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { getClient, site } from '$lib/api/client.svelte' import { getClient, site } from '$lib/api/client.svelte'
import type { SaveUserSettings } from '$lib/api/types' import type { SaveUserSettings } from '$lib/api/types'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
import ImageInputUpload from '$lib/ui/form/ImageInputUpload.svelte' import ImageInputUpload from '$lib/ui/form/ImageInputUpload.svelte'
+1 -1
View File
@@ -1,5 +1,5 @@
import { client } from '$lib/api/client.svelte' import { client } from '$lib/api/client.svelte'
import { profile } from '$lib/app/auth.svelte' import { profile } from '$lib/app/auth'
import { error } from '@sveltejs/kit' import { error } from '@sveltejs/kit'
// disable ssr, as the server cannot be authenticated // disable ssr, as the server cannot be authenticated
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff. Show more