Implement flmt default to creationdate if URL

If a URL is given instead of a file, flmt will default to creationdate.
This is temporary (?) since we can't easily find flmt from URL.
This commit is contained in:
Luxray5474 2020-08-24 16:58:33 -04:00
parent 22f2b21450
commit a13bcbea25
2 changed files with 4 additions and 2 deletions

View file

@ -175,9 +175,11 @@ class PostUploadController {
// if uploadable.source is ever going to be a valid field (e.g when setting source directly in the upload window) // if uploadable.source is ever going to be a valid field (e.g when setting source directly in the upload window)
// you'll need to change the line below to `post.source = uploadable.source || uploadable.url;` // you'll need to change the line below to `post.source = uploadable.source || uploadable.url;`
if (uploadable.url) { if (uploadable.url) {
// For now, if the input is a URL, flmt will be same as creation date
post.source = uploadable.url; post.source = uploadable.url;
} else {
post.fileLastModifiedTime = uploadable.file.lastModified;
} }
post.fileLastModifiedTime = uploadable.file.lastModified; // The client already reads the data anyway, which is convenient
return post; return post;
} }
} }

View file

@ -89,7 +89,7 @@ def create_post(
posts.update_post_flags(post, flags) posts.update_post_flags(post, flags)
if ctx.has_param("fileLastModifiedTime"): if ctx.has_param("fileLastModifiedTime"):
posts.update_post_file_last_modified_time( posts.update_post_file_last_modified_time(
post, ctx.get_as_param("file_last_modified_time") post, ctx.get_param_as_int("fileLastModifiedTime")
) )
if ctx.has_file("thumbnail"): if ctx.has_file("thumbnail"):
posts.update_post_thumbnail(post, ctx.get_file("thumbnail")) posts.update_post_thumbnail(post, ctx.get_file("thumbnail"))