refactor(desktop): update SharePanel and UrlBuilder for improved share URL handling

- Refactored SharePanel to retrieve the share URL directly from the entry data.
- Enhanced UrlBuilder with a new method for generating share URLs that includes view and subscription parameters.
- Updated the shareEntry method to utilize the new structure for better flexibility.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-06-06 18:43:45 +08:00
parent 56677aaddc
commit 059ab9d996
3 changed files with 42 additions and 8 deletions
+1 -5
View File
@@ -1,6 +1,6 @@
export class UrlBuilder {
constructor(private readonly webUrl: string) {}
private join(path: string, query?: Record<string, string>) {
protected join(path: string, query?: Record<string, string>) {
const nextUrl = new URL(this.webUrl)
nextUrl.pathname = path
if (query) {
@@ -17,10 +17,6 @@ export class UrlBuilder {
return this.join(`share/lists/${id}`, view ? { view: view.toString() } : undefined)
}
shareEntry(id: string) {
return this.join(`timeline/view-0/all/${id}`, { share: "1" })
}
profile(id: string) {
return this.join(`share/users/${id}`)
}