Skip to content

Commit f35998a

Browse files
authored
Merge pull request #521 from CyferShepard/unstable
Release V1.1.9
2 parents 3fae9f7 + a5bd0ec commit f35998a

3 files changed

Lines changed: 41 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
**Jellystat** is a free and open source Statistics App for Jellyfin! (This project is still in development - expect some weirdness)
44

5+
## PROJECT UPDATE
6+
7+
> Hi Everyone. Just wanted to give an update. A lot of bugs and issues keep pilling up, and since it was one of the first projects i made using Node.js there was alot that i learnt which could have been done better.</br></br>
8+
> I'v decided to rebuild Jellystat from the ground up, using a more modern architecture. This means new backend language, new frontend and possibly a new database provider, i may stick to Postgres but i also want to see if maybe theres something better. </br></br>
9+
> For now, what this means is , for a while, the project is not going to be updated. I will probably push a few fixes for any major bugs that are easily reproduced.
10+
511
## Current Features
612

713
- Session Monitoring and logging

backend/routes/backup.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,39 @@ function readFile(path) {
4242
});
4343
}
4444

45+
function getBirthtimeFallback(fileStats, fileName) {
46+
// Try to get birthtime metadata
47+
if (fileStats.birthtime && fileStats.birthtime.getTime() > 0) {
48+
return fileStats.birthtime;
49+
}
50+
51+
// Fallback to changetime
52+
if (fileStats.ctime && fileStats.ctime.getTime() > 0) {
53+
return fileStats.ctime;
54+
}
55+
56+
// Fallback to modified time
57+
if (fileStats.mtime && fileStats.mtime.getTime() > 0) {
58+
return fileStats.mtime;
59+
}
60+
61+
// Fallback to filename parsing
62+
// format is 4digits-2digis-2digits(' ' or '_' or 'T')
63+
// 2digits('-' or ':')2digits('-' or ':')2digits
64+
const regexp = /(\d{4})-(\d{2})-(\d{2})[ _T](\d{2})[-:](\d{2})[-:](\d{2})/;
65+
const matches = fileName.match(regexp);
66+
if (!matches)
67+
return null;
68+
69+
// Verify that each regex match is a valid number
70+
for (var i=1; i<7; i++) {
71+
if (Number.isNaN(Number(matches[i])))
72+
return null;
73+
}
74+
75+
return new Date(matches[1], matches[2]-1, matches[3], matches[4], matches[5], matches[6]);
76+
}
77+
4578
async function restore(file, refLog) {
4679
refLog.logData.push({ color: "lawngreen", Message: "Starting Restore" });
4780
refLog.logData.push({
@@ -182,7 +215,7 @@ router.get("/files", (req, res) => {
182215
return {
183216
name: file,
184217
size: stats.size,
185-
datecreated: stats.birthtime,
218+
datecreated: getBirthtimeFallback(stats, file),
186219
};
187220
});
188221
res.json(fileData);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jfstat",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"private": true,
55
"main": "src/index.jsx",
66
"scripts": {

0 commit comments

Comments
 (0)