From e33a94bd726e1171a71d1321ea5f1031c241731a Mon Sep 17 00:00:00 2001 From: zhangkeyang Date: Fri, 26 Apr 2024 11:21:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8ES=20API=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80=E5=92=8C=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 31248d1..25b00f9 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -238,7 +238,7 @@ function uploadFile(index, file) { var formData = new FormData(); formData.append('file', file); $.ajax({ - url: 'http://127.0.0.1:8000/upload', + url: `http://${window.location.hostname}:${window.location.port}/upload`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -284,7 +284,7 @@ function uploadFile(index, file) { */ function playFile(index, file, id) { $('#video-modal').find('.modal-title').text(`预览${file ? file.name : '此视频'}的关键镜头`); - $('#video-modal').find('video').attr('src', `http://127.0.0.1:8000/fetch/${id}`); + $('#video-modal').find('video').attr('src', `http://${window.location.hostname}:${window.location.port}/fetch/${id}`); var player = new Plyr('video'); $('#video-modal').on('hidden.bs.modal', function(event) { player.pause(); @@ -303,7 +303,7 @@ function extractFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/extract', + url: `http://${window.location.hostname}:${window.location.port}/extract`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -331,7 +331,7 @@ function analyseFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/analyse', + url: `http://${window.location.hostname}:${window.location.port}/analyse`, type: 'POST', data: formData, processData: false, // 不处理发送的数据 @@ -359,7 +359,7 @@ function generateFile(index, file, id) { var formData = new FormData(); formData.append('id', id); $.ajax({ - url: 'http://127.0.0.1:8000/generate', + url: `http://${window.location.hostname}:${window.location.port}/generate`, type: 'POST', data: formData, processData: false, // 不处理发送的数据