diff --git a/src/models/Image.js b/src/models/Image.js index 9b3d765..3396571 100644 --- a/src/models/Image.js +++ b/src/models/Image.js @@ -8,7 +8,8 @@ const imageSchema = new Schema({ originalname: {type: String}, copyright_name: {type: String}, copyright_link: {type: String}, - youtubeid: {type: String}, + video_type: {type: Number}, + video_id: {type: String}, mimetype: {type: String}, size: { type: Number}, created_at: {type: Date, default: Date.now()} diff --git a/src/routes/index.js b/src/routes/index.js index 8f3a87f..769bc04 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -47,7 +47,8 @@ router.post('/upload', async (req, res) => { image.description = req.body.description; image.copyright_link = req.body.copyright_link; image.copyright_name = req.body.copyright_name; - image.youtubeid = req.body.youtubeid; + image.video_type = req.body.video_type; + image.video_id = req.body.video_id; image.filename = req.file.filename; image.path = '/img/uploads/' + req.file.filename; image.originalname = req.file.originalname; diff --git a/src/views/partials/videoscripts.ejs b/src/views/partials/videoscripts.ejs index d1334f3..a1d4152 100644 --- a/src/views/partials/videoscripts.ejs +++ b/src/views/partials/videoscripts.ejs @@ -1,19 +1,23 @@ - \ No newline at end of file +<% if (typeof image.video_id === 'string' && image.video_id.length !== 0 && typeof image.video_type === 'number' && image.video_type.length !== 0) {%> + <% if (image.video_type === 1) {%> + + <% } %> +<% } %> \ No newline at end of file diff --git a/src/views/profile.ejs b/src/views/profile.ejs index 8ff0b50..3977764 100644 --- a/src/views/profile.ejs +++ b/src/views/profile.ejs @@ -10,7 +10,7 @@
- <% if (typeof image.youtubeid === 'string' && image.youtubeid.length !== 0) {%><%- include("partials/videoscripts") -%><% } %> + <% if (typeof image.video_id === 'string' && image.video_id.length !== 0) {%><%- include("partials/videoscripts") -%><% } %> <%- include("partials/navigation") %><%= image.title %>
<%= image.description %>
- <% if (typeof image.youtubeid === 'string' && image.youtubeid.length !== 0) {%> - + <% if (typeof image.video_id === 'string' && image.video_id.length !== 0) {%> + <% if (image.video_type === 1) {%> + + <% } %> + <% if (image.video_type === 2) {%> + + <% } %> <% } %> <%= image.copyright_name %>