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 18, 2024
1 parent 55ec454 commit f0520ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/guest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { getBuilder } from '@nextcloud/browser-storage'

Check failure on line 1 in lib/guest.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Unable to resolve path to module '@nextcloud/browser-storage'

const browserStorage = getBuilder('public').persist().build()

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

/**
* Set the guest nickname for public shares
* @param nickname The nickname to set
*/
export function setGuestNickname(nickname: string): void {
browserStorage.setItem('guestNickname', nickname)
}
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export type { NextcloudUser } from './user'

export { getRequestToken, onRequestTokenUpdate } from './requesttoken'
export { getCurrentUser } from './user'
export { getGuestNickname, setGuestNickname } from './guest'

0 comments on commit f0520ce

Please sign in to comment.