mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 11:40:32 +02:00
Add user API token with copy to clipboard
This commit is contained in:
parent
08e648a3bc
commit
1dde02b170
2 changed files with 26 additions and 0 deletions
|
@ -125,6 +125,23 @@ Vue.prototype.$sanitizeFilename = (input, replacement = '') => {
|
|||
return sanitized
|
||||
}
|
||||
|
||||
Vue.prototype.$copyToClipboard = (str, ctx) => {
|
||||
return new Promise((resolve) => {
|
||||
if (!navigator.clipboard) {
|
||||
console.warn('Clipboard not supported')
|
||||
return resolve(false)
|
||||
}
|
||||
navigator.clipboard.writeText(str).then(() => {
|
||||
console.log('Clipboard copy success', str)
|
||||
ctx.$toast.success('Copied to clipboard')
|
||||
resolve(true)
|
||||
}, (err) => {
|
||||
console.error('Clipboard copy failed', str, err)
|
||||
resolve(false)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function xmlToJson(xml) {
|
||||
const json = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue