ComposerUpdate

This commit is contained in:
Anyon 2020-11-05 14:54:13 +08:00
parent e258622de4
commit b16d4d9c3a
4 changed files with 14 additions and 13 deletions

View File

@ -941,12 +941,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "a82943543b07edf766267b888345bfa912cb2cee" "reference": "baae4158f9d045299e9c6d8f7dba8bddafbf15f0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a82943543b07edf766267b888345bfa912cb2cee", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/baae4158f9d045299e9c6d8f7dba8bddafbf15f0",
"reference": "a82943543b07edf766267b888345bfa912cb2cee", "reference": "baae4158f9d045299e9c6d8f7dba8bddafbf15f0",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -963,7 +963,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-11-03T09:51:30+00:00", "time": "2020-11-05T04:10:07+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-11-03 21:05:50 // This file is automatically generated at:2020-11-05 14:53:51
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -82,23 +82,23 @@ class Library extends Service
$this->app->request->setPathinfo($_SERVER['argv'][1]); $this->app->request->setPathinfo($_SERVER['argv'][1]);
} }
} else { } else {
$isSess = intval($this->app->request->get('not_init_session', '0')) === 0; $issess = intval($this->app->request->get('not_init_session', '0')) === 0;
$notYar = stripos($this->app->request->header('user_agent', ''), 'PHP Yar RPC-') === false; $notapi = stripos($this->app->request->header('user_agent', ''), 'PHP Yar RPC-') === false;
if ($notYar && $isSess) { if ($notapi && $issess) {
// 注册会话初始化中间键 // 注册会话初始化中间键
$this->app->middleware->add(SessionInit::class); $this->app->middleware->add(SessionInit::class);
// 注册语言包处理中间键 // 注册语言包处理中间键
$this->app->middleware->add(LoadLangPack::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 = []; $header = [];
if (($origin = $request->header('origin', '*')) !== '*') { if (($origin = $request->header('origin', '*')) !== '*') {
$header['Access-Control-Allow-Origin'] = $origin; $header['Access-Control-Allow-Origin'] = $origin;
$header['Access-Control-Allow-Methods'] = 'GET,POST,PATCH,PUT,DELETE'; $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'; $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-Allow-Credentials'] = 'true';
$header['Access-Control-Expose-Headers'] = '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()) { if ($request->isOptions()) {

View File

@ -144,9 +144,10 @@ class SystemService extends Service
*/ */
public function sysuri(string $url = '', array $vars = [], $suffix = true, $domain = false): string 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')); $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')]; [$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()); return preg_replace($pattern, ['', '$1$2', '$1$2'], $this->app->route->buildUrl($url, $vars)->suffix($suffix)->domain($domain)->build());
} }