From f31e6daf7b3a2fdfaf670f59b188f4adda7ac68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn> Date: Tue, 26 Apr 2022 10:29:26 +0800 Subject: [PATCH] Fix notice not clear (#1416) --- admin/common-js.php | 11 ++++++----- var/Typecho/Cookie.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/admin/common-js.php b/admin/common-js.php index 02a8c7a8..592eb4df 100644 --- a/admin/common-js.php +++ b/admin/common-js.php @@ -13,7 +13,9 @@ noticeType : $.cookie(prefix + '__typecho_notice_type'), highlight : $.cookie(prefix + '__typecho_notice_highlight') }, - path = ''; + path = '', + domain = '', + secure = ; if (!!cookies.notice && 'success|notice|error'.indexOf(cookies.noticeType) >= 0) { var head = $('.typecho-head-nav'), @@ -63,14 +65,13 @@ }); }); - - $.cookie(prefix + '__typecho_notice', null, {path : path}); - $.cookie(prefix + '__typecho_notice_type', null, {path : path}); + $.cookie(prefix + '__typecho_notice', null, {path : path, domain: domain, secure: secure}); + $.cookie(prefix + '__typecho_notice_type', null, {path : path, domain: domain, secure: secure}); } if (cookies.highlight) { $('#' + cookies.highlight).effect('highlight', 1000); - $.cookie(prefix + '__typecho_notice_highlight', null, {path : path}); + $.cookie(prefix + '__typecho_notice_highlight', null, {path : path, domain: domain, secure: secure}); } })(); diff --git a/var/Typecho/Cookie.php b/var/Typecho/Cookie.php index 010b9dbf..ad23a612 100644 --- a/var/Typecho/Cookie.php +++ b/var/Typecho/Cookie.php @@ -85,6 +85,24 @@ class Cookie return self::$path; } + /** + * @access public + * @return string + */ + public static function getDomain(): string + { + return self::$domain; + } + + /** + * @access public + * @return bool + */ + public static function getSecure(): bool + { + return self::$secure ?: false; + } + /** * 设置额外的选项 *