Skip to content

Commit

Permalink
[#] 路由优化
Browse files Browse the repository at this point in the history
  • Loading branch information
WangNingkai committed Dec 31, 2020
1 parent 47fc2a9 commit 9da78fc
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/DriveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public function decrypt(Request $request)
}
if ($need_pass) {
if (strcmp($_password, $input_password) === 0) {
return redirect()->route('drive.query', ['hash' => $hash, 'query' => $redirect])->withCookie("e:{$hash}:{$_encrypt_path}", $data, 600);
return redirect()->route('drive.query', ['hash' => $hash, 'query' => url_encode($redirect)])->withCookie("e:{$hash}:{$_encrypt_path}", $data, 600);
}
}
return redirect()->back();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Kernel extends HttpKernel
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
// 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'throttle' =>\App\Http\Middleware\ThrottleRequests::class,
'throttle' => \App\Http\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'custom' => \App\Http\Middleware\CustomMiddleware::class,
'access_token' => \App\Http\Middleware\AccessTokenMiddleware::class,
Expand Down
10 changes: 5 additions & 5 deletions resources/views/default/admin/manage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class="ri-home-fill"></i> Home</a></li>
@else
@if (!blank($value))
<li class="breadcrumb-item ">
<a href="{{ route('manage.query', ['account_id' => $account_id,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}">
<a href="{{ route('manage.query', ['account_id' => $account_id, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}">
{{ str_limit($value,20) }}
</a>
</li>
Expand All @@ -28,7 +28,7 @@ class="ri-home-fill"></i> Home</a></li>
@else
@if (!blank($value) && $key === (count($path) - 2))
<li class="breadcrumb-item ">
<a href="{{ route('manage.query', ['account_id' => $account_id,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}">
<a href="{{ route('manage.query', ['account_id' => $account_id, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}">
{{ str_limit($value,20) }}
</a>
</li>
Expand Down Expand Up @@ -102,7 +102,7 @@ class="text-decoration-none"><i class="ri-arrow-up-s-line"></i> </a>
</a>
@if(!blank($path))
<a class="btn btn-sm btn-primary mr-2 my-1"
href="{{ route('manage.query', ['account_id' => $account_id, 'query' => \App\Helpers\Tool::fetchGoBack($path)]) }}">
href="{{ route('manage.query', ['account_id' => $account_id, 'query' => url_encode(\App\Helpers\Tool::fetchGoBack($path))]) }}">
<i class="ri-arrow-go-back-fill"></i> 返回上级
</a>
@endif
Expand Down Expand Up @@ -138,11 +138,11 @@ class="ri-pencil-line"></i> 编辑readme.md</a>
data-name="{{ $data['name'] }}"
data-file="{{ !array_has($data,'folder') }}"
data-size="{{ $data['size'] }}"
data-route="{{ route('manage.query', ['account_id' => $account_id, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}">
data-route="{{ route('manage.query', ['account_id' => $account_id, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name'])))]) }}">
<td class="col-5"
style="text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">
<a title="{{ $data['name'] }}"
href="{{ route('manage.query', ['account_id' => $account_id, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}"
href="{{ route('manage.query', ['account_id' => $account_id, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name'])))]) }}"
class="text-decoration-none stretched-link">
<i class="ri-{{ \App\Helpers\Tool::fetchExtIco($data['ext'] ?? 'file') }}-fill"></i>
{{ $data['name'] }}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/default/components/breadcrumb.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class="ri-home-fill"></i> Home</a></li>
@else
@if (!blank($value))
<li class="breadcrumb-item ">
<a href="{{ route('drive.query', ['hash' => $hash,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}">
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}">
{{ str_limit($value,20) }}
</a>
</li>
Expand All @@ -25,7 +25,7 @@ class="ri-home-fill"></i> Home</a></li>
@else
@if (!blank($value) && $key === (count($path) - 2))
<li class="breadcrumb-item ">
<a href="{{ route('drive.query', ['hash' => $hash,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}">
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}">
{{ str_limit($value,20) }}
</a>
</li>
Expand Down
8 changes: 4 additions & 4 deletions resources/views/default/one.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class="text-decoration-none"><i class="ri-arrow-up-s-line"></i> </a>
<tr class="row mx-0">
<td colspan="4">
<a class="text-decoration-none"
href="{{ route('drive.query', ['hash' => $hash, 'query' => \App\Helpers\Tool::fetchGoBack($path)]) }}">
href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::fetchGoBack($path))]) }}">
<i class="ri-arrow-go-back-fill"></i> 返回上级
</a>
</td>
Expand All @@ -102,10 +102,10 @@ class="text-decoration-none"><i class="ri-arrow-up-s-line"></i> </a>
@else
@foreach($list as $data)
<tr class="list-item row mx-0 align-items-center"
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}">
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) ))]) }}">
<td class="col-5"
style="text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">
<a title="{{ $data['name'] }}" href="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}"
<a title="{{ $data['name'] }}" href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name'])))]) }}"
class="text-decoration-none stretched-link">
<i class="ri-{{ \App\Helpers\Tool::fetchExtIco($data['ext'] ?? 'file') }}-fill"></i>
{{ $data['name'] }}
Expand All @@ -118,7 +118,7 @@ class="text-decoration-none stretched-link">
@if(array_has($data,'folder'))
-
@else
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) ),'download' => 1]) }}"
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )),'download' => 1]) }}"
class="btn btn-sm btn-primary download mr-2 my-1">下载</a>
@endif
</td>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/default/preview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="input-group mb-3">
<label for="link1"></label>
<input type="text" id="link1" class="form-control"
value="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => implode('/', $path),'download' => 1])) }}">
value="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', $path)),'download' => 1])) }}">
<div class="input-group-append">
<a href="javascript:void(0)" style="text-decoration: none" data-toggle="tooltip"
data-placement="right" data-clipboard-target="#link1" class="clipboard"><span
Expand All @@ -26,7 +26,7 @@ class="input-group-text">复制</span></a>
</div>
</div>
<div class="text-center">
<a href="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => implode('/', $path),'download' => 1])) }}"
<a href="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', $path)),'download' => 1])) }}"
class="btn btn-success"><i class="ri-download-cloud-fill"></i> 下载</a>
</div>

Expand Down
4 changes: 2 additions & 2 deletions resources/views/mdui/layouts/appbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white mdui-hidden-sm-up"
@if (!blank($value))
<i class="mdui-icon material-icons mdui-hidden-xs mdui-m-a-0"
>chevron_right</i>
<a href="{{ route('drive.query', ['hash' => $hash,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}"
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}"
class="mdui-typo-subheading mdui-hidden-xs">
{{ $value }}
</a>
Expand All @@ -52,7 +52,7 @@ class="mdui-typo-subheading mdui-hidden-xs">
@if (!blank($value) && $key === (count($path) - 2))
<i class="mdui-icon material-icons mdui-hidden-xs mdui-m-a-0"
>chevron_right</i>
<a href="{{ route('drive.query', ['hash' => $hash,'query' => \App\Helpers\Tool::combineBreadcrumb($key + 1, $path)]) }}"
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::combineBreadcrumb($key + 1, $path))]) }}"
class="mdui-typo-subheading mdui-hidden-xs">
{{ $value }}
</a>
Expand Down
12 changes: 6 additions & 6 deletions resources/views/mdui/one.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
</li>
@if(!blank($path))
<li class="mdui-list-item mdui-ripple"
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => \App\Helpers\Tool::fetchGoBack($path)]) }}">
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::fetchGoBack($path))]) }}">
<div class="mdui-col-sm-12">
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => \App\Helpers\Tool::fetchGoBack($path)]) }}">
<a href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(\App\Helpers\Tool::fetchGoBack($path))]) }}">
<i class="mdui-icon material-icons">arrow_back</i>
返回上级
</a>
Expand All @@ -77,13 +77,13 @@
@else
@foreach($list as $data)
<li class="mdui-list-item mdui-ripple"
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}">
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name'])))]) }}">
<div class="mdui-row mdui-col-sm-12">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
@if (array_has($data,'folder') )
<a
data-name="{{ $data['name'] }}"
href="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}"
href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) ))]) }}"
aria-label="Folder"
>
<i class="mdui-icon material-icons">folder_open</i>
Expand All @@ -92,7 +92,7 @@
@else
<a
data-name="{{ $data['name'] }}"
href="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )]) }}"
href="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name'])))]) }}"
aria-label="File"
>
<i class="mdui-icon material-icons"> insert_drive_file </i>
Expand All @@ -113,7 +113,7 @@
mdui-tooltip="{content: '下载'}"
aria-label="Download"
href="javascript:void(0)"
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) ),'download' => 1]) }}"
data-route="{{ route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', array_add($path, key(array_slice($path, -1, 1, true)) + 1, $data['name']) )),'download' => 1]) }}"
target="_blank">
<i class="mdui-icon material-icons">file_download</i>
</a>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/mdui/preview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class="mdui-typo-subheading-opacity">{{ convert_size($file['size']) .' / '.date(
<div class="mdui-textfield">
<i class="mdui-icon material-icons">links</i>
<input class="mdui-textfield-input" type="text" id="link"
value="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => implode('/', $path),'download' => 1])) }}"/>
value="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', $path)),'download' => 1])) }}"/>

</div>
<button
Expand All @@ -29,7 +29,7 @@ class="clipboard mdui-btn mdui-btn-raised mdui-btn-dense mdui-ripple mdui-color-
</div>
</div>
</div>
<a href="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => implode('/', $path),'download' => 1])) }}"
<a href="{{ shorten_url(route('drive.query', ['hash' => $hash, 'query' => url_encode(implode('/', $path)),'download' => 1])) }}"
class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"
><i class="mdui-icon material-icons">file_download</i></a>
@stop
Expand Down

0 comments on commit 9da78fc

Please sign in to comment.