Add last modified tracking: show 'Last modified: date by username' in document viewer

- Added modified_by column to files table
- Updated WOPI PutFile to track who modified the file
- Updated view handlers to return file metadata (name, size, lastModified, modifiedByName)
- Updated Flutter models and UI to display last modified info
This commit is contained in:
Leon Bösche
2026-01-13 16:45:57 +01:00
parent 6943e95479
commit 6ce43a3c9b
9 changed files with 134 additions and 318 deletions

View File

@@ -520,6 +520,12 @@ func viewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB, jwtM
IsPdf bool `json:"isPdf"`
MimeType string `json:"mimeType"`
} `json:"capabilities"`
FileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
LastModified string `json:"lastModified"`
ModifiedByName string `json:"modifiedByName"`
} `json:"fileInfo"`
ExpiresAt string `json:"expiresAt"`
}{
ViewUrl: downloadPath,
@@ -530,6 +536,17 @@ func viewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB, jwtM
IsPdf bool `json:"isPdf"`
MimeType string `json:"mimeType"`
}{CanEdit: false, CanAnnotate: isPdf, IsPdf: isPdf, MimeType: mimeType},
FileInfo: struct {
Name string `json:"name"`
Size int64 `json:"size"`
LastModified string `json:"lastModified"`
ModifiedByName string `json:"modifiedByName"`
}{
Name: file.Name,
Size: file.Size,
LastModified: file.LastModified.UTC().Format(time.RFC3339),
ModifiedByName: file.ModifiedByName,
},
ExpiresAt: time.Now().Add(24 * time.Hour).UTC().Format(time.RFC3339),
}
@@ -606,6 +623,12 @@ func userViewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
IsPdf bool `json:"isPdf"`
MimeType string `json:"mimeType"`
} `json:"capabilities"`
FileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
LastModified string `json:"lastModified"`
ModifiedByName string `json:"modifiedByName"`
} `json:"fileInfo"`
ExpiresAt string `json:"expiresAt"`
}{
ViewUrl: downloadPath,
@@ -621,6 +644,17 @@ func userViewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
IsPdf: isPdf,
MimeType: mimeType,
},
FileInfo: struct {
Name string `json:"name"`
Size int64 `json:"size"`
LastModified string `json:"lastModified"`
ModifiedByName string `json:"modifiedByName"`
}{
Name: file.Name,
Size: file.Size,
LastModified: file.LastModified.UTC().Format(time.RFC3339),
ModifiedByName: file.ModifiedByName,
},
ExpiresAt: time.Now().Add(24 * time.Hour).UTC().Format(time.RFC3339),
}