修改功能
This commit is contained in:
@@ -5,6 +5,16 @@ const test = require('node:test');
|
||||
|
||||
const VideoPages = require('../public/js/video-pages.js');
|
||||
|
||||
function fileAccess(name, mediaType, url) {
|
||||
return {
|
||||
fileId: '2060000000000000090',
|
||||
ossId: '2060000000000000091',
|
||||
fileName: name,
|
||||
mediaType,
|
||||
accessUrl: url
|
||||
};
|
||||
}
|
||||
|
||||
test('视频页只从 URL 读取真实家谱和视频编号', () => {
|
||||
assert.equal(VideoPages.getCurrentGenealogyId('?genealogyId=2060000000000000001&videoId=2060000000000000002'), '2060000000000000001');
|
||||
assert.equal(VideoPages.getCurrentVideoId('?genealogyId=2060000000000000001&videoId=2060000000000000002'), '2060000000000000002');
|
||||
@@ -54,8 +64,8 @@ test('视频响应使用 PC VideoVo 字段并拒绝不安全长 ID', () => {
|
||||
surname: '叶',
|
||||
videoTitle: '祭祖活动记录',
|
||||
videoDesc: '活动影像',
|
||||
coverOssId: '2060000000000000003',
|
||||
videoOssId: '2060000000000000004',
|
||||
coverFile: fileAccess('cover.jpg', 'image/jpeg', 'https://files.example/video-cover.jpg'),
|
||||
videoFile: fileAccess('video.mp4', 'video/mp4', 'https://files.example/video.mp4'),
|
||||
durationSeconds: 180,
|
||||
publisherUserId: '2060000000000000005',
|
||||
publisherNickName: '叶子',
|
||||
@@ -73,8 +83,18 @@ test('视频响应使用 PC VideoVo 字段并拒绝不安全长 ID', () => {
|
||||
surname: '叶',
|
||||
videoTitle: '祭祖活动记录',
|
||||
videoDesc: '活动影像',
|
||||
coverOssId: '2060000000000000003',
|
||||
videoOssId: '2060000000000000004',
|
||||
coverFile: {
|
||||
fileId: '2060000000000000090',
|
||||
fileName: 'cover.jpg',
|
||||
mediaType: 'image/jpeg',
|
||||
accessUrl: 'https://files.example/video-cover.jpg'
|
||||
},
|
||||
videoFile: {
|
||||
fileId: '2060000000000000090',
|
||||
fileName: 'video.mp4',
|
||||
mediaType: 'video/mp4',
|
||||
accessUrl: 'https://files.example/video.mp4'
|
||||
},
|
||||
durationSeconds: 180,
|
||||
publisherUserId: '2060000000000000005',
|
||||
publisherNickName: '叶子',
|
||||
@@ -89,7 +109,7 @@ test('视频响应使用 PC VideoVo 字段并拒绝不安全长 ID', () => {
|
||||
videoId: Number('2060000000000000001'),
|
||||
genealogyId: '2',
|
||||
videoTitle: '标题',
|
||||
videoOssId: '3',
|
||||
videoFile: fileAccess('video.mp4', 'video/mp4', 'https://files.example/video.mp4'),
|
||||
status: '0'
|
||||
}), null);
|
||||
});
|
||||
@@ -100,8 +120,8 @@ test('视频渲染展示业务信息但不直接暴露 OSS ID 和发布人手机
|
||||
genealogyId: '2',
|
||||
videoTitle: '<script>alert(1)</script>',
|
||||
videoDesc: '活动影像',
|
||||
coverOssId: '3',
|
||||
videoOssId: '4',
|
||||
coverFile: fileAccess('cover.jpg', 'image/jpeg', 'https://files.example/video-cover.jpg'),
|
||||
videoFile: fileAccess('video.mp4', 'video/mp4', 'https://files.example/video.mp4'),
|
||||
durationSeconds: 180,
|
||||
publisherUserId: '5',
|
||||
publisherNickName: '叶子',
|
||||
|
||||
Reference in New Issue
Block a user