From 9ba0e52bb7945ae1698710e2149c2c5d6a9b4051 Mon Sep 17 00:00:00 2001
From: Cassie Esposito
Date: Fri, 17 Jun 2022 01:26:10 -0700
Subject: [PATCH 1/4] Added an option to change date format
---
client/pages/config/index.vue | 12 ++++++++++++
client/pages/item/_id/index.vue | 7 +++++--
client/plugins/init.client.js | 2 +-
client/store/globals.js | 17 +++++++++++++++--
server/objects/settings/ServerSettings.js | 5 ++++-
5 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue
index 3dda0a60..1b46046f 100644
--- a/client/pages/config/index.vue
+++ b/client/pages/config/index.vue
@@ -156,6 +156,15 @@
+
+
Your Progress: {{ Math.round(progressPercent * 100) }}%
-
Finished {{ $formatDate(userProgressFinishedAt, 'MM/dd/yyyy') }}
+
Finished {{ $formatDate(userProgressFinishedAt, dateFormat) }}
{{ $elapsedPretty(userTimeRemaining) }} remaining
-
Started {{ $formatDate(userProgressStartedAt, 'MM/dd/yyyy') }}
+
Started {{ $formatDate(userProgressStartedAt, dateFormat) }}
close
@@ -226,6 +226,9 @@ export default {
}
},
computed: {
+ dateFormat() {
+ return this.$store.state.serverSettings.dateFormat
+ },
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js
index bdc1b2f5..4e39ef51 100644
--- a/client/plugins/init.client.js
+++ b/client/plugins/init.client.js
@@ -169,7 +169,7 @@ Vue.prototype.$sanitizeSlug = (str) => {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i))
}
- str = str.replace('.', '-') // replace a dot by a dash
+ str = str.replace('.', '-') // replace a dot by a dash
.replace(/[^a-z0-9 -_]/g, '') // remove invalid chars
.replace(/\s+/g, '-') // collapse whitespace and replace by a dash
.replace(/-+/g, '-') // collapse dashes
diff --git a/client/store/globals.js b/client/store/globals.js
index b02eb286..f1bb51f4 100644
--- a/client/store/globals.js
+++ b/client/store/globals.js
@@ -1,4 +1,3 @@
-
export const state = () => ({
isMobile: false,
isMobileLandscape: false,
@@ -12,7 +11,21 @@ export const state = () => ({
selectedCollection: null,
selectedAuthor: null,
isCasting: false, // Actively casting
- isChromecastInitialized: false // Script loaded
+ isChromecastInitialized: false, // Script loaded
+ dateFormats: [
+ {
+ text: 'MM/DD/YYYY',
+ value: 'MM/dd/yyyy'
+ },
+ {
+ text: 'DD/MM/YYYY',
+ value: 'dd/MM/yyyy'
+ },
+ {
+ text: 'YYYY-MM-DD',
+ value: 'yyyy-MM-dd'
+ }
+ ]
})
export const getters = {
diff --git a/server/objects/settings/ServerSettings.js b/server/objects/settings/ServerSettings.js
index 00c56b2a..5a83f330 100644
--- a/server/objects/settings/ServerSettings.js
+++ b/server/objects/settings/ServerSettings.js
@@ -12,7 +12,7 @@ class ServerSettings {
this.scannerPreferAudioMetadata = false
this.scannerPreferOpfMetadata = false
this.scannerPreferMatchedMetadata = false
- this.scannerDisableWatcher = false
+ this.scannerDisableWatcher = false
this.scannerPreferOverdriveMediaMarker = false
// Metadata - choose to store inside users library item folder
@@ -48,6 +48,7 @@ class ServerSettings {
// Misc Flags
this.chromecastEnabled = false
this.enableEReader = false
+ this.dateFormat="MM/dd/yyyy"
this.logLevel = Logger.logLevel
@@ -95,6 +96,7 @@ class ServerSettings {
this.sortingPrefixes = settings.sortingPrefixes || ['the', 'a']
this.chromecastEnabled = !!settings.chromecastEnabled
this.enableEReader = !!settings.enableEReader
+ this.dateFormat = settings.dateFormat
this.logLevel = settings.logLevel || Logger.logLevel
this.version = settings.version || null
@@ -130,6 +132,7 @@ class ServerSettings {
sortingPrefixes: [...this.sortingPrefixes],
chromecastEnabled: this.chromecastEnabled,
enableEReader: this.enableEReader,
+ dateFormat: this.dateFormat,
logLevel: this.logLevel,
version: this.version
}
From b2ee24de98634c56e7a7970daedd0cc40a518767 Mon Sep 17 00:00:00 2001
From: Cassie Esposito
Date: Fri, 17 Jun 2022 01:35:24 -0700
Subject: [PATCH 2/4] Applied dateFormat setting to alternative bookshelf view
---
client/components/cards/LazyBookCard.vue | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue
index 34b0be60..45d49ac7 100644
--- a/client/components/cards/LazyBookCard.vue
+++ b/client/components/cards/LazyBookCard.vue
@@ -144,6 +144,9 @@ export default {
}
},
computed: {
+ dateFormat() {
+ return this.store.state.serverSettings.dateFormat
+ },
showExperimentalFeatures() {
return this.store.state.showExperimentalFeatures
},
@@ -259,9 +262,9 @@ export default {
return this.author
},
displaySortLine() {
- if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs)
- if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs)
- if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt)
+ if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs, this.dateFormat)
+ if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs, this.dateFormat)
+ if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt, this.dateFormat)
if (this.orderBy === 'media.duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false)
if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size)
if (this.orderBy === 'media.numTracks') return `${this.numEpisodes} Episodes`
From 6227d0baa1d27c0f95d13184bb1913f4b3d6e538 Mon Sep 17 00:00:00 2001
From: advplyr
Date: Fri, 17 Jun 2022 19:09:03 -0500
Subject: [PATCH 3/4] Update
---
server/objects/settings/ServerSettings.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/objects/settings/ServerSettings.js b/server/objects/settings/ServerSettings.js
index 5a83f330..84ee80d8 100644
--- a/server/objects/settings/ServerSettings.js
+++ b/server/objects/settings/ServerSettings.js
@@ -48,7 +48,7 @@ class ServerSettings {
// Misc Flags
this.chromecastEnabled = false
this.enableEReader = false
- this.dateFormat="MM/dd/yyyy"
+ this.dateFormat = 'MM/dd/yyyy'
this.logLevel = Logger.logLevel
@@ -96,7 +96,7 @@ class ServerSettings {
this.sortingPrefixes = settings.sortingPrefixes || ['the', 'a']
this.chromecastEnabled = !!settings.chromecastEnabled
this.enableEReader = !!settings.enableEReader
- this.dateFormat = settings.dateFormat
+ this.dateFormat = settings.dateFormat || 'MM/dd/yyyy'
this.logLevel = settings.logLevel || Logger.logLevel
this.version = settings.version || null
From 8ab0f164a63cd42aaa4439c6afbb48ec6e1b1d4f Mon Sep 17 00:00:00 2001
From: advplyr
Date: Sat, 18 Jun 2022 10:32:12 -0500
Subject: [PATCH 4/4] Update server settings ui and add display settings
section
---
client/pages/config/index.vue | 69 +++++++++++++++++------------------
client/tailwind.config.js | 1 +
2 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue
index 1b46046f..f7a5d89c 100644
--- a/client/pages/config/index.vue
+++ b/client/pages/config/index.vue
@@ -4,7 +4,7 @@
-
Settings
+ Settings
@@ -27,26 +27,6 @@
-
-
-
-
- Use square book covers
- info_outlined
-
-
-
-
-
-
-
-
- Use alternative bookshelf view
- info_outlined
-
-
-
-
updateSettingsKey('sortingIgnorePrefix', val)" />
@@ -66,7 +46,36 @@
-
Scanner Settings
+ Display Settings
+
+
+
+
+
+
+ Use square book covers
+ info_outlined
+
+
+
+
+
+
+
+
+ Use alternative bookshelf view
+ info_outlined
+
+
+
+
+
+
Date Format
+
updateSettingsKey('dateFormat', val)" />
+
+
+
+
Scanner Settings
@@ -144,7 +153,7 @@
-
Experimental Feature Settings
+ Experimental Feature Settings
@@ -156,15 +165,6 @@
-
-
-
updateSettingsKey('dateFormat', val)" style="width: 10em; display:inline-flex" />
-
- Date Format
- info_outlined
-
-
-
@@ -297,9 +297,6 @@ export default {
}
},
methods: {
- updateEnableChromecast(val) {
- this.updateServerSettings({ enableChromecast: val })
- },
updateSortingPrefixes(val) {
if (!val || !val.length) {
this.$toast.error('Must have at least 1 prefix')
@@ -337,10 +334,12 @@ export default {
.then((success) => {
console.log('Updated Server Settings', success)
this.updatingServerSettings = false
+ this.$toast.success('Server settings updated')
})
.catch((error) => {
console.error('Failed to update server settings', error)
this.updatingServerSettings = false
+ this.$toast.error('Failed to update server settings')
})
},
initServerSettings() {
diff --git a/client/tailwind.config.js b/client/tailwind.config.js
index b6e831fc..4e5784b7 100644
--- a/client/tailwind.config.js
+++ b/client/tailwind.config.js
@@ -31,6 +31,7 @@ module.exports = {
'20': '5rem',
'24': '6rem',
'32': '8rem',
+ '40': '10rem',
'48': '12rem',
'64': '16rem',
'80': '20rem'