mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-09 02:41:35 +00:00
Compare commits
7 commits
2c3108a1fa
...
62d7097e23
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62d7097e23 | ||
|
|
92df92ec99 | ||
|
|
1c229e0627 | ||
|
|
f8a71cc514 | ||
|
|
63de5bb2d5 | ||
|
|
f47bbc7886 | ||
|
|
a9e12657f5 |
6 changed files with 34 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div ref="wrapper" class="relative">
|
<div ref="wrapper" class="relative">
|
||||||
<input :id="inputId" :name="inputName" ref="input" v-model="inputValue" :type="actualType" :step="step" :min="min" :readonly="readonly" :disabled="disabled" :placeholder="placeholder" dir="auto" class="rounded-sm bg-primary text-gray-200 focus:bg-bg focus:outline-hidden border h-full w-full" :class="classList" @keyup="keyup" @change="change" @focus="focused" @blur="blurred" />
|
<input :id="inputId" :name="inputName" ref="input" v-model="inputValue" :type="actualType" :step="step" :min="min" :readonly="readonly" :disabled="disabled" :placeholder="placeholder" :autocomplete="autocomplete" dir="auto" class="rounded-sm bg-primary text-gray-200 focus:bg-bg focus:outline-hidden border h-full w-full" :class="classList" @keyup="keyup" @change="change" @focus="focused" @blur="blurred" />
|
||||||
<div v-if="clearable && inputValue" class="absolute top-0 right-0 h-full px-2 flex items-center justify-center">
|
<div v-if="clearable && inputValue" class="absolute top-0 right-0 h-full px-2 flex items-center justify-center">
|
||||||
<span class="material-symbols text-gray-300 cursor-pointer" style="font-size: 1.1rem" @click.stop.prevent="clear">close</span>
|
<span class="material-symbols text-gray-300 cursor-pointer" style="font-size: 1.1rem" @click.stop.prevent="clear">close</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,7 +41,8 @@ export default {
|
||||||
step: [String, Number],
|
step: [String, Number],
|
||||||
min: [String, Number],
|
min: [String, Number],
|
||||||
customInputClass: String,
|
customInputClass: String,
|
||||||
trimWhitespace: Boolean
|
trimWhitespace: Boolean,
|
||||||
|
autocomplete: String
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<em v-if="note" class="font-normal text-xs pl-2">{{ note }}</em>
|
<em v-if="note" class="font-normal text-xs pl-2">{{ note }}</em>
|
||||||
</label>
|
</label>
|
||||||
</slot>
|
</slot>
|
||||||
<ui-text-input :placeholder="placeholder || label" :inputId="identifier" ref="input" v-model="inputValue" :disabled="disabled" :readonly="readonly" :type="type" :min="min" :show-copy="showCopy" class="w-full" :class="inputClass" :trim-whitespace="trimWhitespace" @blur="inputBlurred" />
|
<ui-text-input :placeholder="placeholder || label" :inputId="identifier" ref="input" v-model="inputValue" :disabled="disabled" :readonly="readonly" :type="type" :min="min" :show-copy="showCopy" :autocomplete="autocomplete" class="w-full" :class="inputClass" :trim-whitespace="trimWhitespace" @blur="inputBlurred" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -26,7 +26,8 @@ export default {
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
inputClass: String,
|
inputClass: String,
|
||||||
showCopy: Boolean,
|
showCopy: Boolean,
|
||||||
trimWhitespace: Boolean
|
trimWhitespace: Boolean,
|
||||||
|
autocomplete: String
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
<form @submit.prevent="submitServerSetup">
|
<form @submit.prevent="submitServerSetup">
|
||||||
<p class="text-lg font-semibold mb-2 pl-1 text-center">Create Root User</p>
|
<p class="text-lg font-semibold mb-2 pl-1 text-center">Create Root User</p>
|
||||||
<ui-text-input-with-label v-model.trim="newRoot.username" label="Username" :disabled="processing" class="w-full mb-3 text-sm" />
|
<ui-text-input-with-label v-model.trim="newRoot.username" label="Username" autocomplete="username" :disabled="processing" class="w-full mb-3 text-sm" />
|
||||||
<ui-text-input-with-label v-model="newRoot.password" label="Password" type="password" :disabled="processing" class="w-full mb-3 text-sm" />
|
<ui-text-input-with-label v-model="newRoot.password" label="Password" type="password" autocomplete="new-password" :disabled="processing" class="w-full mb-3 text-sm" />
|
||||||
<ui-text-input-with-label v-model="confirmPassword" label="Confirm Password" type="password" :disabled="processing" class="w-full mb-3 text-sm" />
|
<ui-text-input-with-label v-model="confirmPassword" label="Confirm Password" type="password" autocomplete="new-password" :disabled="processing" class="w-full mb-3 text-sm" />
|
||||||
|
|
||||||
<p class="text-lg font-semibold mt-6 mb-2 pl-1 text-center">Directory Paths</p>
|
<p class="text-lg font-semibold mt-6 mb-2 pl-1 text-center">Directory Paths</p>
|
||||||
<ui-text-input-with-label v-model="ConfigPath" label="Config Path" disabled class="w-full mb-3 text-sm" />
|
<ui-text-input-with-label v-model="ConfigPath" label="Config Path" disabled class="w-full mb-3 text-sm" />
|
||||||
|
|
@ -51,10 +51,10 @@
|
||||||
|
|
||||||
<form v-show="login_local" @submit.prevent="submitForm">
|
<form v-show="login_local" @submit.prevent="submitForm">
|
||||||
<label class="text-xs text-gray-300 uppercase">{{ $strings.LabelUsername }}</label>
|
<label class="text-xs text-gray-300 uppercase">{{ $strings.LabelUsername }}</label>
|
||||||
<ui-text-input v-model.trim="username" :disabled="processing" class="mb-3 w-full" inputName="username" />
|
<ui-text-input v-model.trim="username" autocomplete="username" :disabled="processing" class="mb-3 w-full" inputName="username" />
|
||||||
|
|
||||||
<label class="text-xs text-gray-300 uppercase">{{ $strings.LabelPassword }}</label>
|
<label class="text-xs text-gray-300 uppercase">{{ $strings.LabelPassword }}</label>
|
||||||
<ui-text-input v-model.trim="password" type="password" :disabled="processing" class="w-full mb-3" inputName="password" />
|
<ui-text-input v-model.trim="password" type="password" autocomplete="current-password" :disabled="processing" class="w-full mb-3" inputName="password" />
|
||||||
<div class="w-full flex justify-end py-3">
|
<div class="w-full flex justify-end py-3">
|
||||||
<ui-btn type="submit" :disabled="processing" color="bg-primary" class="leading-none">{{ processing ? 'Checking...' : $strings.ButtonSubmit }}</ui-btn>
|
<ui-btn type="submit" :disabled="processing" color="bg-primary" class="leading-none">{{ processing ? 'Checking...' : $strings.ButtonSubmit }}</ui-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ const languageCodeMap = {
|
||||||
he: { label: 'עברית', dateFnsLocale: 'he' },
|
he: { label: 'עברית', dateFnsLocale: 'he' },
|
||||||
hr: { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
hr: { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
||||||
it: { label: 'Italiano', dateFnsLocale: 'it' },
|
it: { label: 'Italiano', dateFnsLocale: 'it' },
|
||||||
|
ja: { label: '日本語', dateFnsLocale: 'ja' },
|
||||||
lt: { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
lt: { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
||||||
hu: { label: 'Magyar', dateFnsLocale: 'hu' },
|
hu: { label: 'Magyar', dateFnsLocale: 'hu' },
|
||||||
ko: { label: '한국어', dateFnsLocale: 'ko' },
|
ko: { label: '한국어', dateFnsLocale: 'ko' },
|
||||||
|
|
@ -60,6 +61,7 @@ const podcastSearchRegionMap = {
|
||||||
hr: { label: 'Hrvatska' },
|
hr: { label: 'Hrvatska' },
|
||||||
il: { label: 'ישראל / إسرائيل' },
|
il: { label: 'ישראל / إسرائيل' },
|
||||||
it: { label: 'Italia' },
|
it: { label: 'Italia' },
|
||||||
|
jp: { label: '日本' },
|
||||||
lu: { label: 'Luxembourg / Luxemburg / Lëtezebuerg' },
|
lu: { label: 'Luxembourg / Luxemburg / Lëtezebuerg' },
|
||||||
hu: { label: 'Magyarország' },
|
hu: { label: 'Magyarország' },
|
||||||
nl: { label: 'Nederland' },
|
nl: { label: 'Nederland' },
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,14 @@ class ApiCacheManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearUserProgressSlices(modelName, hook) {
|
clearUserProgressSlices(modelName, hook) {
|
||||||
const removedPersonalized = this.modelsInvalidatingPersonalized.has(modelName) ? this.clearByUrlPattern(/^\/libraries\/[^/]+\/personalized/) : 0
|
let removedPersonalized = 0
|
||||||
|
let removedRecentEpisodes = 0
|
||||||
|
if (this.modelsInvalidatingPersonalized.has(modelName)) {
|
||||||
|
removedPersonalized = this.clearByUrlPattern(/^\/libraries\/[^/]+\/personalized/)
|
||||||
|
removedRecentEpisodes = this.clearByUrlPattern(/^\/libraries\/[^/]+\/recent-episodes/)
|
||||||
|
}
|
||||||
const removedMe = this.modelsInvalidatingMe.has(modelName) ? this.clearByUrlPattern(/^\/me(\/|\?|$)/) : 0
|
const removedMe = this.modelsInvalidatingMe.has(modelName) ? this.clearByUrlPattern(/^\/me(\/|\?|$)/) : 0
|
||||||
Logger.debug(
|
Logger.debug(`[ApiCacheManager] ${modelName}.${hook}: cleared user-progress cache slices (personalized=${removedPersonalized}, recentEpisodes=${removedRecentEpisodes}, me=${removedMe})`)
|
||||||
`[ApiCacheManager] ${modelName}.${hook}: cleared user-progress cache slices (personalized=${removedPersonalized}, me=${removedMe})`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clear(model, hook) {
|
clear(model, hook) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Import dependencies and modules for testing
|
// Import dependencies and modules for testing
|
||||||
const { expect } = require('chai')
|
const { expect } = require('chai')
|
||||||
const sinon = require('sinon')
|
const sinon = require('sinon')
|
||||||
|
const { LRUCache } = require('lru-cache')
|
||||||
const ApiCacheManager = require('../../../server/managers/ApiCacheManager')
|
const ApiCacheManager = require('../../../server/managers/ApiCacheManager')
|
||||||
|
|
||||||
describe('ApiCacheManager', () => {
|
describe('ApiCacheManager', () => {
|
||||||
|
|
@ -94,4 +95,17 @@ describe('ApiCacheManager', () => {
|
||||||
expect(res.originalSend.calledWith(body)).to.be.true
|
expect(res.originalSend.calledWith(body)).to.be.true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('clear on mediaProgress', () => {
|
||||||
|
it('should remove recent-episodes cache entries', () => {
|
||||||
|
const key = JSON.stringify({ user: 'u', url: '/libraries/abc-123/recent-episodes?limit=50&page=0' })
|
||||||
|
const cache = new LRUCache({ max: 10 })
|
||||||
|
cache.set(key, { body: '[]', headers: {}, statusCode: 200 })
|
||||||
|
const manager = new ApiCacheManager(cache)
|
||||||
|
|
||||||
|
manager.clear({ name: 'mediaProgress' }, 'afterUpdate')
|
||||||
|
|
||||||
|
expect(cache.get(key)).to.be.undefined
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue