Skip to content

Commit

Permalink
💄 Updating the UI and style files.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xxb committed Mar 18, 2020
1 parent 5441496 commit 8ee4598
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 52 deletions.
38 changes: 1 addition & 37 deletions application/http/middleware/Initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,11 @@ public function handle(Request $request, \Closure $next)
$banIp = $this->getConfig('ban_ip');
if ($banIp) {
$ips = explode(',', str_replace('', ',', $banIp));
if ($this->banIp($request->ip(), $ips)) {
if (in_array($request->ip(), $ips)) {
throw new HttpResponseException(Response::code(403));
}
}

return $next($request);
}

/**
* 拦截某个IP, 支持通配符
*
* @param string $ip
* @param array $ips
* @return bool
*/
private function banIp(string $ip, array $ips)
{
$parts = explode('.', $ip); // 分段当前 IP
$ban = false;
foreach ($ips as $item) {
// 如果直接匹配到
if ($item === $ip) {
$ban = true;
continue;
}

if (strpos($item, '*') !== false) {
$array = explode('.', $item);
$check = true;
for ($i = 0; $i < count($array); $i++) {
if ($array[$i] !== '*' && $array[$i] !== $parts[$i]) {
$check = false;
break;
}
}
if ($check) {
$ban = true;
break;
}
}
}
return $ban;
}
}
4 changes: 4 additions & 0 deletions application/index/controller/admin/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ public function upgrade()
Db::rollback();
$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
} catch (\HttpException $e) {
Db::rollback();
$upgrade->rmdir($upgrade->getWorkspace());
$this->error($e->getMessage());
} catch (\Throwable $e) {
Db::rollback();
$upgrade->rmdir($upgrade->getWorkspace());
Expand Down
7 changes: 0 additions & 7 deletions public/static/app/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/static/app/css/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions public/static/app/css/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,6 @@ body.mdui-theme-layout-dark {

.highlight pre, pre {
background-color: #585858;
code {
color: #ececec;
}
}

p code {
background-color: rgba(255, 255, 255, 0.13);
}

table {
Expand Down

0 comments on commit 8ee4598

Please sign in to comment.