diff --git a/app/Helpers/Function.php b/app/Helpers/Function.php index 15b3936cc..b76b91112 100644 --- a/app/Helpers/Function.php +++ b/app/Helpers/Function.php @@ -3,7 +3,7 @@ if (!function_exists('asset_main')) { function asset_main($path, $secure = null) { - return preg_replace("/^https*:\/\//", "//", app('url')->asset($path, $secure)); + return preg_replace("/^https?:\/\//", "//", app('url')->asset($path, $secure)); } } diff --git a/app/Models/ProjectTaskContent.php b/app/Models/ProjectTaskContent.php index a49d64263..8c947769a 100644 --- a/app/Models/ProjectTaskContent.php +++ b/app/Models/ProjectTaskContent.php @@ -74,7 +74,7 @@ class ProjectTaskContent extends AbstractModel $oldContent = $content; $path = 'uploads/task/content/' . date("Ym") . '/' . $task_id . '/'; // - preg_match_all("/]*?src=\\\\?["\']data:image\/(png|jpg|jpeg|webp);base64,(.*?)\\\\?["\']/s', $content, $matchs); foreach ($matchs[2] as $key => $text) { $tmpPath = $path . 'attached/'; Base::makeDir(public_path($tmpPath)); @@ -84,7 +84,7 @@ class ProjectTaskContent extends AbstractModel $content = str_replace($matchs[0][$key], ']+)(["\'][^>]*?>)/i'; + $pattern = '/(]*?src=\\\\?["\'])(https?:\/\/[^\/]+\/)(uploads\/task\/content\/[^\s"\'>]+)(\\\\?["\'][^>]*?>)/i'; $replacement = '$1{{RemoteURL}}$3$4'; $content = preg_replace($pattern, $replacement, $content); // diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index bae963f58..44c488632 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -918,7 +918,7 @@ class WebSocketDialogMsg extends AbstractModel $text = str_replace($str, "[:LINK:{$herf}:{$title}:]", $text); } // 文件分享链接 - preg_match_all("/(https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+)/i", $text, $matchs); + preg_match_all("/(https?:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+)/i", $text, $matchs); if ($matchs) { foreach ($matchs[0] as $str) { preg_match("/\/single\/file\/(.*?)$/i", $str, $match); @@ -986,7 +986,7 @@ class WebSocketDialogMsg extends AbstractModel $link = 0; $mtype = $type; if ($type === 'text') { - if (str_contains($msg['text'], 'userid, false, false, true); // todo 未能在任务end事件来发送任务 return; } - if (!preg_match("/^https*:\/\//", $webhookUrl)) { + if (!preg_match("/^https?:\/\//", $webhookUrl)) { return; } // diff --git a/electron/build.js b/electron/build.js index ad99e6d7b..4970da9c7 100644 --- a/electron/build.js +++ b/electron/build.js @@ -390,7 +390,7 @@ async function published(url) { * @param output */ function genericPublish({url, key, version, output}) { - if (!/https*:\/\//i.test(url)) { + if (!/https?:\/\//i.test(url)) { console.warn("发布地址无效: " + url) return } diff --git a/electron/electron.js b/electron/electron.js index 57c28ada0..67c1b881f 100644 --- a/electron/electron.js +++ b/electron/electron.js @@ -351,6 +351,7 @@ function createChildWindow(args) { } else { // 创建新窗口 browser = new BrowserWindow(options) + console.log("create new window") } browser.on('page-title-updated', (event, title) => { diff --git a/electron/render/tabs/index.html b/electron/render/tabs/index.html index 724ea8c53..31aba4716 100644 --- a/electron/render/tabs/index.html +++ b/electron/render/tabs/index.html @@ -154,7 +154,7 @@ return 'Loading...' } if (item.url) { - return `${item.url}`.replace(/^https*:\/\//, '') + return `${item.url}`.replace(/^https?:\/\//, '') } }, diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index ef8218fb6..52a82f48f 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -99,7 +99,7 @@ VueRouter.prototype.push = function push(location) { } const router = new VueRouter({ - mode: isSoftware && !/https*:/i.test(window.location.protocol) ? 'hash' : 'history', + mode: isSoftware && !/https?:/i.test(window.location.protocol) ? 'hash' : 'history', routes }); diff --git a/resources/assets/js/components/ImgUpload.vue b/resources/assets/js/components/ImgUpload.vue index d05f3aab7..e529f074a 100755 --- a/resources/assets/js/components/ImgUpload.vue +++ b/resources/assets/js/components/ImgUpload.vue @@ -414,7 +414,7 @@ export default { }, browseStyle(thumb) { - if (!/https*:\/\//.test(thumb) && !/^\//.test(thumb)) { + if (!/https?:\/\//.test(thumb) && !/^\//.test(thumb)) { thumb = $A.mainUrl(thumb); } return { diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index ad533cf5d..5330a5e29 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -328,10 +328,10 @@ import {convertLocalResourcePath} from "../components/Replace/utils"; text = text.replace(/\{\{RemoteURL\}\}/g, $A.mainUrl()) text = text.replace(atReg, ``) // 处理内容连接 - if (/https*:\/\//.test(text)) { + if (/https?:\/\//.test(text)) { text = text.split(/(<[^>]*>)/g).map(string => { if (string && !/<[^>]*>/.test(string)) { - string = string.replace(/(^|[^'"])((https*:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+))/g, "$1$2") + string = string.replace(/(^|[^'"])((https?:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+))/g, "$1$2") } return string; }).join("") diff --git a/resources/assets/js/pages/index.vue b/resources/assets/js/pages/index.vue index b2fe3e54c..75ca35859 100644 --- a/resources/assets/js/pages/index.vue +++ b/resources/assets/js/pages/index.vue @@ -11,7 +11,7 @@ export default { }, mounted() { - if (/^https*:/i.test(window.location.protocol)) { + if (/^https?:/i.test(window.location.protocol)) { let redirect = null if (this.$router.mode === "hash") { if ($A.stringLength(window.location.pathname) > 2) { diff --git a/resources/assets/js/pages/login.vue b/resources/assets/js/pages/login.vue index ac527b84b..f11d4deee 100644 --- a/resources/assets/js/pages/login.vue +++ b/resources/assets/js/pages/login.vue @@ -445,7 +445,7 @@ export default { if (!/\/api\/$/.test(url)) { url = url + ($A.rightExists(url, "/") ? "api/" : "/api/"); } - if (!/^https*:\/\//i.test(url)) { + if (!/^https?:\/\//i.test(url)) { url = `https://${url}`; } this.$store.dispatch("call", { @@ -460,7 +460,7 @@ export default { } }).catch(({ret, msg}) => { if (ret === -1001) { - if (!/^https*:\/\//i.test(value)) { + if (!/^https?:\/\//i.test(value)) { this.inputServerChack(`http://${value}`).then(resolve).catch(reject); return; } diff --git a/resources/assets/js/pages/manage/application.vue b/resources/assets/js/pages/manage/application.vue index aba0ff335..0a171e64a 100644 --- a/resources/assets/js/pages/manage/application.vue +++ b/resources/assets/js/pages/manage/application.vue @@ -533,7 +533,7 @@ export default { }, // 扫一扫 scanResult(text) { - const arr = (text + "").match(/^https*:\/\/(.*?)\/login\?qrcode=(.*?)$/) + const arr = (text + "").match(/^https?:\/\/(.*?)\/login\?qrcode=(.*?)$/) if (arr) { // 扫码登录 if ($A.getDomain(text) != $A.getDomain($A.mainUrl())) { @@ -551,7 +551,7 @@ export default { this.scanLoginShow = true; return } - if (/^https*:\/\//i.test(text)) { + if (/^https?:\/\//i.test(text)) { // 打开链接 this.$store.dispatch('openAppChildPage', { pageType: 'app', diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 50d41c039..2ddafce87 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -120,7 +120,7 @@ export default { const cloneParams = $A.cloneJSON(params) return new Promise(async (resolve, reject) => { // 判断服务器地址 - if (/^https*:\/\/public\//.test(params.url)) { + if (/^https?:\/\/public\//.test(params.url)) { reject({ret: -1, data: {}, msg: "No server address"}) return } @@ -3399,7 +3399,7 @@ export default { * @param streamUrl */ streamDialogMsg({state, dispatch}, streamUrl) { - if (!/^https*:\/\//i.test(streamUrl)) { + if (!/^https?:\/\//i.test(streamUrl)) { streamUrl = $A.mainUrl(streamUrl.substring(1)) } if (state.dialogSseList.find(item => item.streamUrl == streamUrl)) {