diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 88ed373d9..4fac8cc72 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,6 +27,11 @@ module ApplicationHelper sanitize content, tags: tags, attributes: attributes end + # MD5加密 + def md5_encode(content) + Digest::MD5.hexdigest(content) + end + def graduation_navigation graduation graduation.class.to_s == "GraduationTopic" ? "毕设选题" : "毕设任务" end diff --git a/app/views/users/videos/_video.json.jbuilder b/app/views/users/videos/_video.json.jbuilder index 5b0bc7a6e..eb5fafec5 100644 --- a/app/views/users/videos/_video.json.jbuilder +++ b/app/views/users/videos/_video.json.jbuilder @@ -1,4 +1,6 @@ json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded +json.play_url md5_encode(video.play_url) +json.file_url md5_encode(video.file_url) json.play_duration video.video_play_duration json.published_at video.display_published_at json.created_at video.display_created_at