1diff --git a/Makefile b/Makefile
2index b18993b3a1d074320216b62d9f8344ba839d51fa..f1c2095dd81cc0b1c7fbd2d258fb56129635f3e9 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -21,8 +21,7 @@ run: sass
6 $(GO_RUN) $(SERVER) \
7 --log-level error \
8 --aes-key=6368616e676520746869732070617373 \
9- --cache-path=${HOME}/.thumb \
10- --root=${HOME}
11+ --cache-path=${HOME}/.thumb
12
13 sass:
14 @mkdir -p static
15diff --git a/cmd/server/main.go b/cmd/server/main.go
16index b81b2916115977c566ef4ae741e144368e9e933b..8f163dfd6e4f2471f99d51b530cd816a0f184ebf 100644
17--- a/cmd/server/main.go
18+++ b/cmd/server/main.go
19@@ -62,6 +62,10 @@ if err = sql.Migrate(db); err != nil {
20 panic("failed to migrate database: " + err.Error())
21 }
22
23+ if *dbType == "sqlite" {
24+ *schedulerCount = 1
25+ }
26+
27 hexKey, err := hex.DecodeString(*key)
28 if err != nil {
29 panic("failed to decode key database: " + err.Error())
30@@ -104,7 +108,7 @@ for _, v := range []view.View{
31 view.NewAuthView(userController),
32 view.NewFileSystemView(*fileSystemController, settingsRepository),
33 view.NewSettingsView(settingsRepository, userRepository),
34- view.NewMediaView(mediaRepository),
35+ view.NewMediaView(mediaRepository, userRepository),
36 } {
37 v.SetMyselfIn(extRouter)
38 }
39diff --git a/pkg/database/repository/media.go b/pkg/database/repository/media.go
40index 6ab4ee673adc2f12d4227113c9ef4822b5d34d0b..6f5b39b5326491e889cca59690c8a1fe00ff4fee 100644
41--- a/pkg/database/repository/media.go
42+++ b/pkg/database/repository/media.go
43@@ -41,6 +41,7 @@
44 Pagination struct {
45 Page int
46 Size int
47+ Path string
48 }
49
50 CreateMedia struct {
51diff --git a/pkg/database/sql/media.go b/pkg/database/sql/media.go
52index b8203f382fb83a92aa9d8447afda5918188166af..e5ba517408453841bee462e8bc432879423564f4 100644
53--- a/pkg/database/sql/media.go
54+++ b/pkg/database/sql/media.go
55@@ -139,6 +139,7 @@ WithContext(ctx).
56 Model(&Media{}).
57 Offset(pagination.Page * pagination.Size).
58 Limit(pagination.Size).
59+ Where("path like '" + pagination.Path + "%'").
60 Order("created_at DESC").
61 Find(&medias)
62
63@@ -257,7 +258,7 @@ result := r.db.
64 WithContext(ctx).
65 Model(&Media{}).
66 Joins("left join media_exifs on media.id = media_exifs.media_id").
67- Where("media_exifs.media_id IS NULL").
68+ Where("media_exifs.media_id IS NULL AND media.path like '" + pagination.Path + "%'").
69 Offset(pagination.Page * pagination.Size).
70 Limit(pagination.Size).
71 Order("media.created_at DESC").
72@@ -280,7 +281,7 @@ result := r.db.
73 WithContext(ctx).
74 Model(&Media{}).
75 Joins("left join media_thumbnails on media.id = media_thumbnails.media_id").
76- Where("media_thumbnails.media_id IS NULL").
77+ Where("media_thumbnails.media_id IS NULL AND media.path like '" + pagination.Path + "%'").
78 Offset(pagination.Page * pagination.Size).
79 Limit(pagination.Size).
80 Order("media.created_at DESC").
81diff --git a/pkg/fileop/file.go b/pkg/fileop/file.go
82index 10e220242ecdd4124c057cca253bacb095bcc7a9..8999f07e61484609eab2b648107f23643c545284 100644
83--- a/pkg/fileop/file.go
84+++ b/pkg/fileop/file.go
85@@ -12,7 +12,8 @@ return hex.EncodeToString(hash[:])
86 }
87
88 func IsMimeTypeSupported(mimetype string) bool {
89- if mimetype == "image/svg+xml" {
90+ if mimetype == "image/svg+xml" ||
91+ mimetype == "video/mp2t" {
92 return false
93 }
94 return strings.HasPrefix(mimetype, "video") ||
95diff --git a/pkg/service/filesystem.go b/pkg/service/filesystem.go
96index cdfd106746896e4f7ad9cca777b4595346443258..2e4b51099efa02ec811011baa731bd4f4ae2795e 100644
97--- a/pkg/service/filesystem.go
98+++ b/pkg/service/filesystem.go
99@@ -87,7 +87,7 @@ return nil, err
100 }
101
102 params := list.Map(files, func(info fs.FileInfo) *FileParam {
103- fullPath := path.Join(fullPath, info.Name())
104+ fullPath := path.Join(decodedPath, info.Name())
105 scapedFullPath := url.QueryEscape(fullPath)
106 return &FileParam{
107 Info: info,
108diff --git a/pkg/view/media.go b/pkg/view/media.go
109index bea515d9e6657d47e21c4136a57a94995734b0f8..6d380e25a294884a3bc8de9e9c090b1bd33bb31a 100644
110--- a/pkg/view/media.go
111+++ b/pkg/view/media.go
112@@ -13,6 +13,7 @@
113 type (
114 MediaView struct {
115 mediaRepository repository.MediaRepository
116+ userRepository repository.UserRepository
117 }
118
119 Page struct {
120@@ -51,14 +52,26 @@ Size: size,
121 }
122 }
123
124-func NewMediaView(mediaRepository repository.MediaRepository) *MediaView {
125+func NewMediaView(
126+ mediaRepository repository.MediaRepository,
127+ userRepository repository.UserRepository,
128+) *MediaView {
129 return &MediaView{
130 mediaRepository: mediaRepository,
131+ userRepository: userRepository,
132 }
133 }
134
135 func (self *MediaView) Index(ctx *fasthttp.RequestCtx) error {
136 p := getPagination(ctx)
137+ token := ext.GetTokenFromCtx(ctx)
138+
139+ userPath, err := self.userRepository.GetPathFromUserID(ctx, token.UserID)
140+ if err != nil {
141+ return err
142+ }
143+
144+ p.Path = userPath
145 medias, err := self.mediaRepository.List(ctx, p)
146 if err != nil {
147 return err
148diff --git a/pkg/worker/scanner/thumbnail_scanner.go b/pkg/worker/scanner/thumbnail_scanner.go
149index 02fd4dd51d4c215edb4a03d2f2d6ce05ef371afb..8245eadd895f1910ff2482d1af5c68be8db9658f 100644
150--- a/pkg/worker/scanner/thumbnail_scanner.go
151+++ b/pkg/worker/scanner/thumbnail_scanner.go
152@@ -35,6 +35,12 @@ Size: 100,
153 })
154 }
155
156+func (t *ThumbnailScanner) OnFail(ctx context.Context, media *repository.Media, err error) {
157+ _ = t.repository.CreateThumbnail(ctx, media.ID, &repository.MediaThumbnail{
158+ Path: "",
159+ })
160+}
161+
162 func (t *ThumbnailScanner) Process(ctx context.Context, media *repository.Media) error {
163 split := media.PathHash[:2]
164 filename := media.PathHash[2:]