@axium/kino 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/frontend.js
CHANGED
|
@@ -12,14 +12,14 @@ async function toastUpload(upload, name) {
|
|
|
12
12
|
io.start(text('kino.uploading', { name }));
|
|
13
13
|
try {
|
|
14
14
|
const result = await upload(controller.signal);
|
|
15
|
-
|
|
15
|
+
void toast('success', text('kino.upload_success'));
|
|
16
16
|
return result;
|
|
17
17
|
}
|
|
18
18
|
catch (e) {
|
|
19
19
|
if (e instanceof DOMException && e.name == 'AbortError')
|
|
20
|
-
|
|
20
|
+
void toast('info', text('kino.upload_cancelled'));
|
|
21
21
|
else
|
|
22
|
-
|
|
22
|
+
void toast('error', e);
|
|
23
23
|
}
|
|
24
24
|
finally {
|
|
25
25
|
io.done(true);
|
package/dist/server/api/views.js
CHANGED
|
@@ -53,9 +53,13 @@ addRoute({
|
|
|
53
53
|
])
|
|
54
54
|
.where('kino_tv_views.userId', '=', userId)
|
|
55
55
|
.orderBy('kino_tv_views.viewedAt', 'desc')
|
|
56
|
-
|
|
56
|
+
// Only one row per show survives the dedupe below, so fetch extra to avoid a short list
|
|
57
|
+
.limit(limit * 4)
|
|
57
58
|
.execute(),
|
|
58
59
|
]);
|
|
60
|
+
/** A show should take one slot no matter how many of its episodes were watched */
|
|
61
|
+
const seenShows = new Set();
|
|
62
|
+
const latestPerShow = episodes.filter(row => !seenShows.has(row.showId) && seenShows.add(row.showId));
|
|
59
63
|
const views = [
|
|
60
64
|
...movies.map(({ viewedAt, position, duration, uploadedAt, uploadName, size, type, ...movie }) => ({
|
|
61
65
|
type: 'movie',
|
|
@@ -64,7 +68,7 @@ addRoute({
|
|
|
64
68
|
duration,
|
|
65
69
|
movie: { ...movie, upload: { uploadedAt, name: uploadName, size, type } },
|
|
66
70
|
})),
|
|
67
|
-
...
|
|
71
|
+
...latestPerShow.map(row => ({
|
|
68
72
|
type: 'tv',
|
|
69
73
|
viewedAt: row.viewedAt,
|
|
70
74
|
position: row.position,
|