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 ef2b2bb
Show file tree
Hide file tree
Showing 4 changed files with 56 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'

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'
36 changes: 36 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 @@ -31,6 +31,7 @@
"url": "https://github.com/nextcloud/nextcloud-auth"
},
"dependencies": {
"@nextcloud/browser-storage": "^0.4.0",
"@nextcloud/event-bus": "^3.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit ef2b2bb

Please sign in to comment.