no message

This commit is contained in:
kuaifan 2024-11-18 23:27:01 +08:00
parent fba98db7cb
commit 2c407bea78
14 changed files with 21 additions and 20 deletions

View File

@ -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));
}
}

View File

@ -74,7 +74,7 @@ class ProjectTaskContent extends AbstractModel
$oldContent = $content;
$path = 'uploads/task/content/' . date("Ym") . '/' . $task_id . '/';
//
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|webp);base64,(.*?)\"/s", $content, $matchs);
preg_match_all('/<img[^>]*?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], '<img src="{{RemoteURL}}' . $tmpPath . '" original-width="' . $paramet[0] . '" original-height="' . $paramet[1] . '"', $content);
}
}
$pattern = '/(<img[^>]*?src=["\'])(https?:\/\/[^\/]+)(\/uploads\/task\/content\/[^\s"\'>]+)(["\'][^>]*?>)/i';
$pattern = '/(<img[^>]*?src=\\\\?["\'])(https?:\/\/[^\/]+\/)(uploads\/task\/content\/[^\s"\'>]+)(\\\\?["\'][^>]*?>)/i';
$replacement = '$1{{RemoteURL}}$3$4';
$content = preg_replace($pattern, $replacement, $content);
//

View File

@ -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'], '<a ') || preg_match("/https*:\/\//", $msg['text'])) {
if (str_contains($msg['text'], '<a ') || preg_match("/https?:\/\//", $msg['text'])) {
$link = 1;
}
if (str_contains($msg['text'], '<img ')) {
@ -1004,7 +1004,7 @@ class WebSocketDialogMsg extends AbstractModel
$mtype = 'image';
}
} elseif ($type === 'location') {
if (preg_match('/^https*:\/\//', $msg['thumb'])) {
if (preg_match('/^https?:\/\//', $msg['thumb'])) {
$thumb = file_get_contents($msg['thumb']);
if (empty($thumb)) {
throw new ApiException('获取地图快照失败');

View File

@ -524,7 +524,7 @@ class BotReceiveMsgTask extends AbstractTask
], $botUser->userid, false, false, true); // todo 未能在任务end事件来发送任务
return;
}
if (!preg_match("/^https*:\/\//", $webhookUrl)) {
if (!preg_match("/^https?:\/\//", $webhookUrl)) {
return;
}
//

2
electron/build.js vendored
View File

@ -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
}

View File

@ -351,6 +351,7 @@ function createChildWindow(args) {
} else {
// 创建新窗口
browser = new BrowserWindow(options)
console.log("create new window")
}
browser.on('page-title-updated', (event, title) => {

View File

@ -154,7 +154,7 @@
return 'Loading...'
}
if (item.url) {
return `${item.url}`.replace(/^https*:\/\//, '')
return `${item.url}`.replace(/^https?:\/\//, '')
}
},

View File

@ -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
});

View File

@ -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 {

View File

@ -328,10 +328,10 @@ import {convertLocalResourcePath} from "../components/Replace/utils";
text = text.replace(/\{\{RemoteURL\}\}/g, $A.mainUrl())
text = text.replace(atReg, `<span class="mention me" data-id="${userid}">`)
// 处理内容连接
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<a href=\"$2\" target=\"_blank\">$2</a>")
string = string.replace(/(^|[^'"])((https?:\/\/)((\w|=|\?|\.|\/|&|-|:|\+|%|;|#|@|,|!)+))/g, "$1<a href=\"$2\" target=\"_blank\">$2</a>")
}
return string;
}).join("")

View File

@ -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) {

View File

@ -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;
}

View File

@ -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',

View File

@ -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)) {