mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	* Update: `pages/items/_id` toast messages * Update: account modal strings * Update: audio file data modal strings * Update: sleep timer set string * Update: loading indicator string * Update: lazy book card strings * Reorder keys * Fix: syntax error in LazyBookCard * Fix: json ordering * Fix: fix double message definition * Update: login form toast strings * Update: batch delete toast * Update: collection add toast messages * Replace: toasts in BookShelfToolbar * Update: playlist edit toasts * Update: Details tab * Add: title required string * Update: ereader toasts * Update: author toasts, title and name required toasts * Clean up "no updates" strings * Change: slug strings * Update: cover modal toasts * Change: cancel encode toasts * Change: failed to share toasts * Simplify: "renameFail" and "removeFail" toasts * Fix: ordering * Change: chapters remove toast * Update: notification strings * Revert: loading indicator (error in browser) * Update: collectionBooksTable toast * Update: "failed to get" strings * Update: backup strings * Update: custom provider strings * Update: sessions strings * Update: email strings * Update sort display translation strings, update podcast episode queue strings to use translation * Fix loading indicator please wait translation * Consolidate translations and reduce number of toasts --------- Co-authored-by: advplyr <advplyr@protonmail.com>
		
			
				
	
	
		
			106 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <modals-modal ref="modal" v-model="show" name="custom-metadata-provider" :width="600" :height="'unset'" :processing="processing">
 | |
|     <template #outer>
 | |
|       <div class="absolute top-0 left-0 p-5 w-2/3 overflow-hidden">
 | |
|         <p class="text-3xl text-white truncate">{{ $strings.HeaderAddCustomMetadataProvider }}</p>
 | |
|       </div>
 | |
|     </template>
 | |
|     <form @submit.prevent="submitForm">
 | |
|       <div class="px-4 w-full flex items-center text-sm py-6 rounded-lg bg-bg shadow-lg border border-black-300 overflow-y-auto overflow-x-hidden" style="min-height: 400px; max-height: 80vh">
 | |
|         <div class="w-full p-8">
 | |
|           <div class="flex mb-2">
 | |
|             <div class="w-3/4 p-1">
 | |
|               <ui-text-input-with-label v-model="newName" :label="$strings.LabelName" />
 | |
|             </div>
 | |
|             <div class="w-1/4 p-1">
 | |
|               <ui-text-input-with-label value="Book" readonly :label="$strings.LabelMediaType" />
 | |
|             </div>
 | |
|           </div>
 | |
|           <div class="w-full mb-2 p-1">
 | |
|             <ui-text-input-with-label v-model="newUrl" label="URL" />
 | |
|           </div>
 | |
|           <div class="w-full mb-2 p-1">
 | |
|             <ui-text-input-with-label v-model="newAuthHeaderValue" :label="$strings.LabelProviderAuthorizationValue" type="password" />
 | |
|           </div>
 | |
|           <div class="flex px-1 pt-4">
 | |
|             <div class="flex-grow" />
 | |
|             <ui-btn color="success" type="submit">{{ $strings.ButtonAdd }}</ui-btn>
 | |
|           </div>
 | |
|         </div>
 | |
|       </div>
 | |
|     </form>
 | |
|   </modals-modal>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| export default {
 | |
|   props: {
 | |
|     value: Boolean
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       processing: false,
 | |
|       newName: '',
 | |
|       newUrl: '',
 | |
|       newAuthHeaderValue: ''
 | |
|     }
 | |
|   },
 | |
|   watch: {
 | |
|     show: {
 | |
|       handler(newVal) {
 | |
|         if (newVal) {
 | |
|           this.init()
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|   },
 | |
|   computed: {
 | |
|     show: {
 | |
|       get() {
 | |
|         return this.value
 | |
|       },
 | |
|       set(val) {
 | |
|         this.$emit('input', val)
 | |
|       }
 | |
|     }
 | |
|   },
 | |
|   methods: {
 | |
|     submitForm() {
 | |
|       if (!this.newName || !this.newUrl) {
 | |
|         this.$toast.error(this.$strings.ToastProviderNameAndUrlRequired)
 | |
|         return
 | |
|       }
 | |
| 
 | |
|       this.processing = true
 | |
|       this.$axios
 | |
|         .$post('/api/custom-metadata-providers', {
 | |
|           name: this.newName,
 | |
|           url: this.newUrl,
 | |
|           mediaType: 'book', // Currently only supporting book mediaType
 | |
|           authHeaderValue: this.newAuthHeaderValue
 | |
|         })
 | |
|         .then((data) => {
 | |
|           this.$emit('added', data.provider)
 | |
|           this.$toast.success(this.$strings.ToastProviderCreatedSuccess)
 | |
|           this.show = false
 | |
|         })
 | |
|         .catch((error) => {
 | |
|           const errorMsg = error.response?.data || 'Unknown error'
 | |
|           console.error('Failed to add provider', error)
 | |
|           this.$toast.error(this.$strings.ToastProviderCreatedFailed + ': ' + errorMsg)
 | |
|         })
 | |
|         .finally(() => {
 | |
|           this.processing = false
 | |
|         })
 | |
|     },
 | |
|     init() {
 | |
|       this.processing = false
 | |
|       this.newName = ''
 | |
|       this.newUrl = ''
 | |
|       this.newAuthHeaderValue = ''
 | |
|     }
 | |
|   },
 | |
|   mounted() {}
 | |
| }
 | |
| </script>
 |