diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 357cac77b..6b583e75b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -941,12 +941,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "a82943543b07edf766267b888345bfa912cb2cee" + "reference": "baae4158f9d045299e9c6d8f7dba8bddafbf15f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a82943543b07edf766267b888345bfa912cb2cee", - "reference": "a82943543b07edf766267b888345bfa912cb2cee", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/baae4158f9d045299e9c6d8f7dba8bddafbf15f0", + "reference": "baae4158f9d045299e9c6d8f7dba8bddafbf15f0", "shasum": "", "mirrors": [ { @@ -963,7 +963,7 @@ "ext-mbstring": "*", "topthink/framework": "^6.0" }, - "time": "2020-11-03T09:51:30+00:00", + "time": "2020-11-05T04:10:07+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index 04949e5b1..3f25dea87 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/src/Library.php b/vendor/zoujingli/think-library/src/Library.php index cf1c5435f..fa8588ec7 100644 --- a/vendor/zoujingli/think-library/src/Library.php +++ b/vendor/zoujingli/think-library/src/Library.php @@ -82,23 +82,23 @@ class Library extends Service $this->app->request->setPathinfo($_SERVER['argv'][1]); } } else { - $isSess = intval($this->app->request->get('not_init_session', '0')) === 0; - $notYar = stripos($this->app->request->header('user_agent', ''), 'PHP Yar RPC-') === false; - if ($notYar && $isSess) { + $issess = intval($this->app->request->get('not_init_session', '0')) === 0; + $notapi = stripos($this->app->request->header('user_agent', ''), 'PHP Yar RPC-') === false; + if ($notapi && $issess) { // 注册会话初始化中间键 $this->app->middleware->add(SessionInit::class); // 注册语言包处理中间键 $this->app->middleware->add(LoadLangPack::class); } // 注册访问处理中间键 - $this->app->middleware->add(function (Request $request, \Closure $next) { + $this->app->middleware->add(function (Request $request, \Closure $next) use ($issess, $notapi) { $header = []; if (($origin = $request->header('origin', '*')) !== '*') { $header['Access-Control-Allow-Origin'] = $origin; - $header['Access-Control-Allow-Methods'] = 'GET,POST,PATCH,PUT,DELETE'; - $header['Access-Control-Allow-Headers'] = 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With'; - $header['Access-Control-Allow-Credentials'] = 'true'; + $header['Access-Control-Allow-Methods'] = 'GET,PUT,POST,PATCH,DELETE'; + $header['Access-Control-Allow-Headers'] = 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With,User-Form-Token,User-Token,Token'; $header['Access-Control-Expose-Headers'] = 'User-Form-Token,User-Token,Token'; + $header['Access-Control-Allow-Credentials'] = 'true'; } // 访问模式及访问权限检查 if ($request->isOptions()) { diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index 9cd90fc93..3b469c941 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -144,9 +144,10 @@ class SystemService extends Service */ public function sysuri(string $url = '', array $vars = [], $suffix = true, $domain = false): string { + $hm = $this->app->config->get('route.url_html_suffix', '.html'); $d2 = Str::snake($this->app->config->get('route.default_controller')); [$d1, $d3] = [$this->app->config->get('app.default_app'), $this->app->config->get('route.default_action')]; - $pattern = ["#^/{$d1}/{$d2}/{$d3}(.html)?#i", "#^(/.*?)/{$d2}/{$d3}(^\w|\?|\.|$)#i", "#^(/.*?/.*?)/{$d3}(^\w|\?|\.|$)#i"]; + $pattern = ["#^/{$d1}/{$d2}/{$d3}({$hm})?#i", "#^(/.*?)/{$d2}/{$d3}(^\w|\?|\.|$)#i", "#^(/.*?/.*?)/{$d3}(^\w|\?|\.|$)#i"]; return preg_replace($pattern, ['', '$1$2', '$1$2'], $this->app->route->buildUrl($url, $vars)->suffix($suffix)->domain($domain)->build()); }