Skip to content

Commit 1446ce7

Browse files
authored
Merge pull request #642 from arabcoders/dev
Enhance name normalization and validation with logging
2 parents 570f816 + 0feba24 commit 1446ce7

22 files changed

Lines changed: 485 additions & 192 deletions

File tree

frontend/assets/css/style.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,33 @@ html {
224224
background-repeat: no-repeat;
225225
background-blend-mode: darken;
226226
}
227+
228+
.is-terminal {
229+
background-color: #1f2229 !important;
230+
color: #e3c981;
231+
padding: 0.50rem;
232+
line-height: 1.7;
233+
}
234+
235+
.is-terminal > span:nth-child(even), .is-terminal > code > span:nth-child(even) {
236+
color: #ffc9d4;
237+
}
238+
239+
.is-terminal > span:nth-child(odd), .is-terminal > code > span:nth-child(odd) {
240+
color: #e3c981;
241+
}
242+
243+
.is-terminal {
244+
background-color: #1f2229 !important;
245+
color: #e3c981;
246+
padding: 0.50rem;
247+
line-height: 1.7;
248+
}
249+
250+
.is-terminal > span:nth-child(even), .is-terminal > code > span:nth-child(even) {
251+
color: #ffc9d4;
252+
}
253+
254+
.is-terminal > span:nth-child(odd), .is-terminal > code > span:nth-child(odd) {
255+
color: #e3c981;
256+
}

frontend/components/EventView.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
<span>{{ !toggleData ? 'Show' : 'Hide' }} attached data</span>
9797
</h2>
9898
<div v-if="toggleData" class="is-relative">
99-
<code class="text-container is-block p-4" :class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
99+
<code class="text-container is-block p-4 is-terminal"
100+
:class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
100101
{{ JSON.stringify(item.event_data, null, 2) }}
101102
</code>
102103
<button class="button m-4" v-tooltip="'Copy event data'"
@@ -115,8 +116,9 @@
115116
<span>{{ !toggleLogs ? 'Show' : 'Hide' }} event logs</span>
116117
</h2>
117118
<div v-if="toggleLogs" class="is-relative">
118-
<code class="is-block text-container p-4" :class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
119-
<span class="is-log-line is-block pt-1" v-for="(item, index) in filteredRows" :key="'log_line-' + index"
119+
<code class="is-block text-container p-4 is-terminal"
120+
:class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
121+
<span class="is-block pt-1" v-for="(item, index) in filteredRows" :key="'log_line-' + index"
120122
v-text="item"/>
121123
</code>
122124
<button class="button m-4" v-tooltip="'Copy logs'" @click="() => copyText(filteredRows.join('\n'))"
@@ -134,7 +136,8 @@
134136
<span>{{ !toggleOptions ? 'Show' : 'Hide' }} attached options</span>
135137
</h2>
136138
<div v-if="toggleOptions" class="is-relative">
137-
<code class="is-block text-container p-4" :class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
139+
<code class="is-block text-container p-4 is-terminal"
140+
:class="{ 'is-pre': !wrapLines, 'is-pre-wrap': wrapLines }">
138141
{{ JSON.stringify(item.options, null, 2) }}
139142
</code>
140143
<button class="button m-4" v-tooltip="'Copy options'"
@@ -168,6 +171,9 @@ const toggleData = useStorage('events_toggle_data', true)
168171
const toggleOptions = useStorage('events_toggle_options', true)
169172
const wrapLines = useStorage('logs_wrap_lines', false)
170173
174+
const bg_enable = useStorage('bg_enable', true)
175+
const bg_opacity = useStorage('bg_opacity', 0.95)
176+
171177
watch(toggleFilter, () => {
172178
if (!toggleFilter.value) {
173179
query.value = ''
@@ -182,6 +188,9 @@ const filteredRows = computed(() => {
182188
});
183189
184190
onMounted(async () => {
191+
if (bg_enable.value) {
192+
document.querySelector('body').setAttribute("style", "opacity: 1");
193+
}
185194
if (!props.id) {
186195
throw createError({
187196
statusCode: 404,
@@ -191,6 +200,12 @@ onMounted(async () => {
191200
return await loadContent()
192201
})
193202
203+
onUnmounted(async () => {
204+
if (bg_enable.value && bg_opacity.value) {
205+
document.querySelector('body').setAttribute("style", `opacity: ${bg_opacity.value}`)
206+
}
207+
})
208+
194209
const loadContent = async () => {
195210
try {
196211
isLoading.value = true

frontend/components/Markdown.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ onMounted(async () => {
2323
2424
marked.use({
2525
gfm: true,
26-
renderer: {
27-
text: (text) => {
28-
// -- replace github [!] with icon
26+
hooks: {
27+
postprocess: (text) => {
28+
// -- replace github [! with icon
2929
text = text.replace(/\[!IMPORTANT\]/g, `
3030
<span class="is-block title is-4">
3131
<span class="icon-text">

frontend/pages/backend/[backend]/index.vue

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@
8787
<div class="column is-12">
8888
<h1 class="title is-4">Recent History</h1>
8989
</div>
90-
<div class="column is-6-tablet" v-for="history in bHistory" :key="history.id">
91-
<div class="card" :class="{ 'is-success': history.watched }">
90+
<div class="column is-6-tablet" v-for="item in bHistory" :key="item.id">
91+
<div class="card" :class="{ 'is-success': item.watched }">
9292
<header class="card-header">
9393
<p class="card-header-title is-text-overflow pr-1">
94-
<NuxtLink :to="`/history/${history.id}`" v-text="makeName(history)"/>
94+
<NuxtLink :to="`/history/${item.id}`" v-text="makeName(item)"/>
9595
</p>
96-
<span class="card-header-icon">
97-
<span class="icon" v-if="'episode' === history.type"><i class="fas fa-tv"></i></span>
96+
<span class="card-header-icon" @click="item.showItem = !item.showItem">
97+
<span class="icon" v-if="'episode' === item.type"><i class="fas fa-tv"></i></span>
9898
<span class="icon" v-else><i class="fas fa-film"></i></span>
9999
</span>
100100
</header>
@@ -104,33 +104,42 @@
104104
<span class="icon-text">
105105
<span class="icon"><i class="fas fa-calendar"></i>&nbsp;</span>
106106
<span class="has-tooltip"
107-
v-tooltip="`Updated at: ${moment.unix(history.updated_at ?? history.updated).format(TOOLTIP_DATE_FORMAT)}`">
108-
{{ moment.unix(history.updated_at ?? history.updated).fromNow() }}
107+
v-tooltip="`Updated at: ${moment.unix(item.updated_at ?? item.updated).format(TOOLTIP_DATE_FORMAT)}`">
108+
{{ moment.unix(item.updated_at ?? item.updated).fromNow() }}
109109
</span>
110110
</span>
111111
</div>
112112
<div class="column is-4-tablet is-6-mobile has-text-right-mobile">
113113
<span class="icon-text">
114114
<span class="icon"><i class="fas fa-server"></i></span>
115115
<span>
116-
<NuxtLink :to="'/backend/'+history.via" v-text="history.via"/>
116+
<NuxtLink :to="'/backend/'+item.via" v-text="item.via"/>
117117
</span>
118118
</span>
119119
</div>
120120
<div class="column is-4-tablet is-12-mobile has-text-left-mobile">
121121
<span class="icon-text">
122122
<span class="icon"><i class="fas fa-envelope"></i></span>
123-
<span>{{ history.event }}</span>
123+
<span>{{ item.event }}</span>
124124
</span>
125125
</div>
126126
</div>
127127
</div>
128-
<div class="card-footer" v-if="history.progress">
128+
<div class="card-content p-0 m-0" v-if="item?.showItem">
129+
<div class="mt-2" style="position: relative; max-height: 343px; overflow-y: auto;">
130+
<code class="is-terminal is-block is-pre-wrap" v-text="JSON.stringify(item, null, 2)"/>
131+
<button class="button m-4" v-tooltip="'Copy text'" style="position: absolute; top:0; right:0;"
132+
@click="() => copyText(JSON.stringify(item, null, 2))">
133+
<span class="icon"><i class="fas fa-copy"/></span>
134+
</button>
135+
</div>
136+
</div>
137+
<div class="card-footer" v-if="item.progress">
129138
<div class="card-footer-item">
130-
<span class="has-text-success" v-if="history.watched">Played</span>
139+
<span class="has-text-success" v-if="item.watched">Played</span>
131140
<span class="has-text-danger" v-else>Unplayed</span>
132141
</div>
133-
<div class="card-footer-item">{{ formatDuration(history.progress) }}</div>
142+
<div class="card-footer-item">{{ formatDuration(item.progress) }}</div>
134143
</div>
135144
</div>
136145
</div>
@@ -149,8 +158,12 @@
149158
<h1 class="title is-4">Basic info</h1>
150159
</div>
151160
<div class="column is-12">
152-
<div class="content">
153-
<code class="is-block is-pre-wrap" v-text="info"></code>
161+
<div class="mt-2" style="position: relative;">
162+
<code class="is-terminal is-block is-pre-wrap" v-text="info"/>
163+
<button class="button m-4" v-tooltip="'Copy text'" style="position: absolute; top:0; right:0;"
164+
@click="() => copyText(JSON.stringify(info, null, 2))">
165+
<span class="icon"><i class="fas fa-copy"/></span>
166+
</button>
154167
</div>
155168
</div>
156169
</div>

frontend/pages/backend/[backend]/mismatched.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@
100100
</div>
101101
</div>
102102
<div class="card-content p-0 m-0" v-if="item?.showItem">
103-
<pre><code>{{ JSON.stringify(item, null, 2) }}</code></pre>
103+
<div class="mt-2" style="position: relative; max-height: 343px; overflow-y: auto;">
104+
<code class="is-terminal is-block is-pre-wrap" v-text="JSON.stringify(item, null, 2)"/>
105+
<button class="button m-4" v-tooltip="'Copy text'" style="position: absolute; top:0; right:0;"
106+
@click="() => copyText(JSON.stringify(item, null, 2))">
107+
<span class="icon"><i class="fas fa-copy"/></span>
108+
</button>
109+
</div>
104110
</div>
105111
</div>
106112
</div>

frontend/pages/backend/[backend]/search.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<p class="card-header-title is-text-overflow">
113113
<NuxtLink :to="item.webUrl" v-text="makeName(item)" target="_blank"/>
114114
</p>
115-
<span class="card-header-icon">
115+
<span class="card-header-icon" @click="item.showItem = !item.showItem">
116116
<span class="icon">
117117
<i class="fas"
118118
:class="{'fa-folder': 'show' === item.type, 'fa-tv': 'episode' === item.type, 'fa-film': 'movie' === item.type}"></i>
@@ -139,6 +139,15 @@
139139
</div>
140140
</div>
141141
</div>
142+
<div class="card-content p-0 m-0" v-if="item?.showItem">
143+
<div class="mt-2" style="position: relative; max-height: 343px; overflow-y: auto;">
144+
<code class="is-terminal is-block is-pre-wrap" v-text="JSON.stringify(item, null, 2)"/>
145+
<button class="button m-4" v-tooltip="'Copy text'" style="position: absolute; top:0; right:0;"
146+
@click="() => copyText(JSON.stringify(item, null, 2))">
147+
<span class="icon"><i class="fas fa-copy"/></span>
148+
</button>
149+
</div>
150+
</div>
142151
<div class="card-footer">
143152
<div class="card-footer-item">
144153
<span class="icon"><i class="fas fa-calendar"></i>&nbsp;</span>

frontend/pages/backend/[backend]/unmatched.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@
100100
</div>
101101
</div>
102102
<div class="card-content p-0 m-0" v-if="item?.showItem">
103-
<pre><code>{{ JSON.stringify(item, null, 2) }}</code></pre>
103+
<div class="mt-2" style="position: relative; max-height: 343px; overflow-y: auto;">
104+
<code class="is-terminal is-block is-pre-wrap" v-text="JSON.stringify(item, null, 2)"/>
105+
<button class="button m-4" v-tooltip="'Copy text'" style="position: absolute; top:0; right:0;"
106+
@click="() => copyText(JSON.stringify(item, null, 2))">
107+
<span class="icon"><i class="fas fa-copy"/></span>
108+
</button>
109+
</div>
104110
</div>
105111
<div class="card-footer">
106112
<div class="card-footer-item">

frontend/pages/console.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</p>
2929
</header>
3030
<section class="card-content p-0 m-0">
31-
<div ref="outputConsole" style="min-height: 60vh;max-height:70vh;"/>
31+
<div ref="outputConsole" style="min-height: 60vh; max-height:70vh;"/>
3232
</section>
3333
<section class="card-content p-1 m-1">
3434
<div class="field">
@@ -106,6 +106,17 @@
106106
</div>
107107
</div>
108108
</template>
109+
<style>
110+
.xterm {
111+
padding: 0.50rem !important;
112+
113+
}
114+
115+
.xterm-viewport {
116+
background-color: #1f2229 !important;
117+
}
118+
119+
</style>
109120

110121
<script setup>
111122
import "@xterm/xterm/css/xterm.css"
@@ -293,11 +304,13 @@ onMounted(async () => {
293304
fontSize: 16,
294305
fontFamily: "'JetBrains Mono', monospace",
295306
cursorBlink: false,
296-
cursorStyle: 'underline',
307+
cursorStyle: 'none',
297308
cols: 108,
298309
rows: 10,
299310
disableStdin: true,
300311
convertEol: true,
312+
altClickMovesCursor: false,
313+
301314
})
302315
terminal.value.open(outputConsole.value)
303316
terminal.value.loadAddon(terminalFit.value)

frontend/pages/history/[id]/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@
439439
</span>
440440
</span>
441441
<p class="subtitle">Useful for debugging.</p>
442-
<div v-if="showRawData" class="mt-2" style="position: relative;">
443-
<code class="is-block is-pre-wrap p-4">{{
442+
<div v-if="showRawData" class="mt-2" style="position: relative; max-height: 400px; overflow-y: auto;">
443+
<code class="is-terminal is-block is-pre-wrap p-4">{{
444444
JSON.stringify(Object.keys(data)
445445
.filter(key => !['files', 'hardware', 'content_exists', '_toggle'].includes(key))
446446
.reduce((obj, key) => {

frontend/pages/history/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@
252252
</div>
253253
</div>
254254
<div class="card-content p-0 m-0" v-if="item?.showRawData">
255-
<pre style="position: relative; max-height: 343px;"><code>{{ JSON.stringify(item, null, 2) }}</code>
256-
<button class="button m-4" @click="() => copyText(JSON.stringify(item, null, 2))"
257-
style="position: absolute; top:0; right:0;">
258-
<span class="icon"><i class="fas fa-copy"></i></span>
259-
</button>
260-
</pre>
255+
<pre class="is-terminal" style="position: relative; max-height: 343px;"><code
256+
v-text="JSON.stringify(item, null, 2)"/><button class="button m-4"
257+
@click="() => copyText(JSON.stringify(item, null, 2))"
258+
style="position: absolute; top:0; right:0;">
259+
<span class="icon"><i class="fas fa-copy"/></span>
260+
</button></pre>
261261
</div>
262262
<div class="card-footer has-text-centered">
263263
<div class="card-footer-item">

0 commit comments

Comments
 (0)