Skip to content

Commit

Permalink
feat: add guest nickname handling
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jul 17, 2024
1 parent 2dd48d4 commit 0a82768
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/publicShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
* @module public
*/
import { loadState } from '@nextcloud/initial-state'
import { getBuilder } from '@nextcloud/browser-storage'

const localStorage = getBuilder('shared')
.persist()
.build()

/**
* Check if the current page is on a public share
Expand All @@ -30,3 +35,18 @@ export function getSharingToken(): string | null {
null
)
}

/**
* Get the guest nickname for public shares
*/
export function getGuestNickname(): string | null {
return localStorage.getItem('guestNickname')
}

/**
* Set the guest nickname for public shares
* @param nickname The nickname to set
*/
export function setGuestNickname(nickname: string): void {
localStorage.setItem('guestNickname', nickname)
}
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
]
},
"dependencies": {
"@nextcloud/browser-storage": "^0.4.0",
"@nextcloud/initial-state": "^2.2.0"
},
"devDependencies": {
Expand Down

0 comments on commit 0a82768

Please sign in to comment.