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 <[email protected]>
  • Loading branch information
skjnldsv committed Jul 17, 2024
1 parent 2dd48d4 commit 8296eb5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/publicShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @module public
*/
import { loadState } from '@nextcloud/initial-state'
import { getBuilder } from '@nextcloud/browser-storage'

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

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

/**
* 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)
}
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 8296eb5

Please sign in to comment.