mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
no message
This commit is contained in:
parent
bb8a6982d0
commit
e4790062c8
@ -322,8 +322,8 @@ class IndexController extends InvokeController
|
|||||||
$path = Arr::get($data, 'path');
|
$path = Arr::get($data, 'path');
|
||||||
$file = public_path($path);
|
$file = public_path($path);
|
||||||
// 防止 ../ 穿越获取到系统文件
|
// 防止 ../ 穿越获取到系统文件
|
||||||
if (strpos(realpath($file), public_path()) !== 0) {
|
if (!str_starts_with(realpath($file), public_path())) {
|
||||||
return abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
@ -331,11 +331,23 @@ class IndexController extends InvokeController
|
|||||||
$name = Arr::get($query, 'name');
|
$name = Arr::get($query, 'name');
|
||||||
$ext = strtolower(Arr::get($query, 'ext'));
|
$ext = strtolower(Arr::get($query, 'ext'));
|
||||||
$userAgent = strtolower(Request::server('HTTP_USER_AGENT'));
|
$userAgent = strtolower(Request::server('HTTP_USER_AGENT'));
|
||||||
if ($ext === 'pdf'
|
if ($ext === 'pdf') {
|
||||||
&& (str_contains($userAgent, 'electron') || str_contains($userAgent, 'chrome'))) {
|
// electron 直接在线预览查看
|
||||||
return Response::download($file, $name, [
|
if (str_contains($userAgent, 'electron')) {
|
||||||
'Content-Type' => 'application/pdf'
|
return Response::download($file, $name, [
|
||||||
], 'inline');
|
'Content-Type' => 'application/pdf'
|
||||||
|
], 'inline');
|
||||||
|
}
|
||||||
|
// EEUI App 直接在线预览查看
|
||||||
|
if (str_contains($userAgent, 'eeui')) {
|
||||||
|
if (str_contains($userAgent, 'iphone') || str_contains($userAgent, 'ipad')) {
|
||||||
|
$message = Base::array2json([
|
||||||
|
'type' => 'currentOpen',
|
||||||
|
'url' => Base::fillUrl($path),
|
||||||
|
]);
|
||||||
|
return "<script>window.top.postMessage($message, '*')</script>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (in_array($ext, File::localExt)) {
|
if (in_array($ext, File::localExt)) {
|
||||||
@ -351,7 +363,7 @@ class IndexController extends InvokeController
|
|||||||
$toUrl = Base::fillUrl("fileview/onlinePreview?url=" . urlencode(base64_encode($url)));
|
$toUrl = Base::fillUrl("fileview/onlinePreview?url=" . urlencode(base64_encode($url)));
|
||||||
return Redirect::to($toUrl, 301);
|
return Redirect::to($toUrl, 301);
|
||||||
}
|
}
|
||||||
return abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -366,6 +378,18 @@ class IndexController extends InvokeController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户信息
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
|
public function setting__userinfo()
|
||||||
|
{
|
||||||
|
return view('setting', [
|
||||||
|
'userid' => Request::input('userid'),
|
||||||
|
'token' => Request::input('token')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提取所有中文
|
* 提取所有中文
|
||||||
* @return array|string
|
* @return array|string
|
||||||
|
|||||||
@ -68,12 +68,14 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', this.windowSizeListener);
|
window.addEventListener('resize', this.windowSizeListener);
|
||||||
window.addEventListener('scroll', this.windowScrollListener);
|
window.addEventListener('scroll', this.windowScrollListener);
|
||||||
|
window.addEventListener('message', this.windowHandleMessage)
|
||||||
this.searchInter = setInterval(this.searchEnter, 1000);
|
this.searchInter = setInterval(this.searchEnter, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener('resize', this.windowSizeListener);
|
window.removeEventListener('resize', this.windowSizeListener);
|
||||||
window.removeEventListener('scroll', this.windowScrollListener);
|
window.removeEventListener('scroll', this.windowScrollListener);
|
||||||
|
window.removeEventListener('message', this.windowHandleMessage)
|
||||||
this.searchInter && clearInterval(this.searchInter);
|
this.searchInter && clearInterval(this.searchInter);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -106,6 +108,7 @@ export default {
|
|||||||
userId: {
|
userId: {
|
||||||
handler() {
|
handler() {
|
||||||
this.$store.dispatch("websocketConnection");
|
this.$store.dispatch("websocketConnection");
|
||||||
|
this.synchUserToken();
|
||||||
//
|
//
|
||||||
if (this.userId > 0) {
|
if (this.userId > 0) {
|
||||||
if (this.$isEEUiApp) {
|
if (this.$isEEUiApp) {
|
||||||
@ -223,6 +226,16 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
synchUserToken() {
|
||||||
|
if (this.isSoftware) {
|
||||||
|
this.iframes = this.iframes.filter(({key}) => key != 'synchUserToken')
|
||||||
|
this.iframes.push({
|
||||||
|
key: 'synchUserToken',
|
||||||
|
url: $A.apiUrl(`../setting/userinfo?userid=${this.userId}&token=${this.userToken}`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
autoTheme() {
|
autoTheme() {
|
||||||
if (this.themeMode === "auto") {
|
if (this.themeMode === "auto") {
|
||||||
this.$store.dispatch("synchTheme")
|
this.$store.dispatch("synchTheme")
|
||||||
@ -271,6 +284,15 @@ export default {
|
|||||||
this.$store.state.windowScrollY = window.scrollY
|
this.$store.state.windowScrollY = window.scrollY
|
||||||
},
|
},
|
||||||
|
|
||||||
|
windowHandleMessage({data}) {
|
||||||
|
data = $A.jsonParse(data);
|
||||||
|
if (data.type === 'currentOpen') {
|
||||||
|
if ($A.getDomain(window.location.href) === $A.getDomain(data.url) || $A.getDomain($A.apiUrl('../')) === $A.getDomain(data.url)) {
|
||||||
|
window.location.href = data.url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
electronEvents() {
|
electronEvents() {
|
||||||
if (!this.$Electron) {
|
if (!this.$Electron) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -5,4 +5,10 @@
|
|||||||
@if ($language)
|
@if ($language)
|
||||||
window.localStorage.setItem("__language:type__", "{{ $language }}");
|
window.localStorage.setItem("__language:type__", "{{ $language }}");
|
||||||
@endif
|
@endif
|
||||||
|
@if ($userid)
|
||||||
|
window.localStorage.setItem("__user:userid__", "{{ $userid }}");
|
||||||
|
@endif
|
||||||
|
@if ($token)
|
||||||
|
window.localStorage.setItem("__user:token__", "{{ $token }}");
|
||||||
|
@endif
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user