Skip to content
Permalink
Browse files

first commit

  • Loading branch information...
WangNingkai committed Sep 29, 2018
0 parents commit d37f3646b3c2b63fb5db9ddc21fdaa8892962314
Showing with 13,572 additions and 0 deletions.
  1. +15 −0 .editorconfig
  2. +47 −0 .env.example
  3. +5 −0 .gitattributes
  4. +14 −0 .gitignore
  5. +46 −0 app/Console/Commands/ResetPassword.php
  6. +42 −0 app/Console/Kernel.php
  7. +51 −0 app/Exceptions/Handler.php
  8. +167 −0 app/Helpers/Tool.php
  9. +13 −0 app/Http/Controllers/Controller.php
  10. +342 −0 app/Http/Controllers/FetchController.php
  11. +140 −0 app/Http/Controllers/ManageController.php
  12. +132 −0 app/Http/Controllers/OauthController.php
  13. +66 −0 app/Http/Kernel.php
  14. +19 −0 app/Http/Middleware/Authenticate.php
  15. +17 −0 app/Http/Middleware/CheckForMaintenanceMode.php
  16. +17 −0 app/Http/Middleware/EncryptCookies.php
  17. +26 −0 app/Http/Middleware/RedirectIfAuthenticated.php
  18. +18 −0 app/Http/Middleware/TrimStrings.php
  19. +23 −0 app/Http/Middleware/TrustProxies.php
  20. +31 −0 app/Http/Middleware/VerifyAccessToken.php
  21. +25 −0 app/Http/Middleware/VerifyAuth.php
  22. +24 −0 app/Http/Middleware/VerifyCsrfToken.php
  23. +252 −0 app/Models/Base.php
  24. +8 −0 app/Models/Parameter.php
  25. +28 −0 app/Providers/AppServiceProvider.php
  26. +30 −0 app/Providers/AuthServiceProvider.php
  27. +21 −0 app/Providers/BroadcastServiceProvider.php
  28. +34 −0 app/Providers/EventServiceProvider.php
  29. +73 −0 app/Providers/RouteServiceProvider.php
  30. +53 −0 artisan
  31. +55 −0 bootstrap/app.php
  32. +2 −0 bootstrap/cache/.gitignore
  33. +68 −0 composer.json
  34. +5,465 −0 composer.lock
  35. +214 −0 config/app.php
  36. +102 −0 config/auth.php
  37. +59 −0 config/broadcasting.php
  38. +94 −0 config/cache.php
  39. +127 −0 config/database.php
  40. +22 −0 config/editor.php
  41. +69 −0 config/filesystems.php
  42. +11 −0 config/graph.php
  43. +52 −0 config/hashing.php
  44. +81 −0 config/logging.php
  45. +123 −0 config/mail.php
  46. +86 −0 config/queue.php
  47. +38 −0 config/services.php
  48. +197 −0 config/session.php
  49. +33 −0 config/tracy.php
  50. +33 −0 config/view.php
  51. +1 −0 database/.gitignore
  52. +23 −0 database/factories/UserFactory.php
  53. +32 −0 database/migrations/2018_09_26_063959_create_parameters_table.php
  54. +17 −0 database/seeds/DatabaseSeeder.php
  55. +87 −0 database/seeds/ParameterTableSeeder.php
  56. +22 −0 package.json
  57. +33 −0 phpunit.xml
  58. +21 −0 public/.htaccess
  59. +6 −0 public/css/app.css
  60. 0 public/favicon.ico
  61. +60 −0 public/index.php
  62. +1 −0 public/js/app.js
  63. +2 −0 public/robots.txt
  64. +1 −0 public/svg/403.svg
  65. +1 −0 public/svg/404.svg
  66. +1 −0 public/svg/500.svg
  67. +1 −0 public/svg/503.svg
  68. +2 −0 public/uploads/content/.gitignore
  69. +3,314 −0 public/vendor/cacert.pem
  70. +1 −0 public/vendor/laravelMde/css/editor.css
  71. +1 −0 public/vendor/laravelMde/css/markdown.css
  72. +23 −0 public/web.config
  73. +83 −0 readme.md
  74. +22 −0 resources/js/app.js
  75. +56 −0 resources/js/bootstrap.js
  76. +23 −0 resources/js/components/ExampleComponent.vue
  77. +19 −0 resources/lang/en/auth.php
  78. +19 −0 resources/lang/en/pagination.php
  79. +22 −0 resources/lang/en/passwords.php
  80. +146 −0 resources/lang/en/validation.php
  81. +20 −0 resources/sass/_variables.scss
  82. +14 −0 resources/sass/app.scss
  83. +30 −0 resources/views/admin/basic.blade.php
  84. +68 −0 resources/views/admin/login.blade.php
  85. +20 −0 resources/views/admin/profile.blade.php
  86. +32 −0 resources/views/admin/show.blade.php
  87. +80 −0 resources/views/layouts/admin.blade.php
  88. +99 −0 resources/views/layouts/main.blade.php
  89. +83 −0 resources/views/onedrive.blade.php
  90. +34 −0 resources/views/show/audio.blade.php
  91. +18 −0 resources/views/show/code.blade.php
  92. +51 −0 resources/views/show/image.blade.php
  93. +18 −0 resources/views/show/stream.blade.php
  94. +36 −0 resources/views/show/video.blade.php
  95. +18 −0 routes/api.php
  96. +16 −0 routes/channels.php
  97. +18 −0 routes/console.php
  98. +36 −0 routes/web.php
  99. +21 −0 server.php
  100. +3 −0 storage/app/.gitignore
  101. +2 −0 storage/app/public/.gitignore
  102. +8 −0 storage/framework/.gitignore
  103. +2 −0 storage/framework/cache/.gitignore
  104. +2 −0 storage/framework/sessions/.gitignore
  105. +2 −0 storage/framework/testing/.gitignore
  106. +2 −0 storage/framework/views/.gitignore
  107. +2 −0 storage/logs/.gitignore
  108. +22 −0 tests/CreatesApplication.php
  109. +21 −0 tests/Feature/ExampleTest.php
  110. +10 −0 tests/TestCase.php
  111. +19 −0 tests/Unit/ExampleTest.php
  112. +15 −0 webpack.mix.js
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
@@ -0,0 +1,47 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

GRAPH_CLIENT_ID=
GRAPH_CLIENT_SECRET=
GRAPH_REDIRECT_URI=
GRAPH_AUTHORITY_URL=https://login.microsoftonline.com/common
GRAPH_AUTHORIZE_ENDPOINT=/oauth2/v2.0/authorize
GRAPH_TOKEN_ENDPOINT=/oauth2/v2.0/token
GRAPH_SCOPES="openid profile user.read files.readwrite.all offline_access"
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
@@ -0,0 +1,14 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
.phpunit.result.cache
@@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
class ResetPassword extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reset:password';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Reset Password';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
*/
public function handle()
{
$password = str_random(8);
DB::table('parameters')->where('name','password')->update(['value' => $password]);
Artisan::call('cache:clear');
$this->info('重置密码成功,新密码:'.$password);
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
@@ -0,0 +1,51 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}
@@ -0,0 +1,167 @@
<?php
namespace App\Helpers;
use App\Models\Parameter;
use HyperDown\Parser;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Session;
class Tool
{
/**
* 操作成功或者失败的提示
* @param string $message
* @param bool $success
*/
public static function showMessage($message = '成功', $success = true)
{
$alertType = $success ? 'success' : 'danger';
Session::put('alertMessage', $message);
Session::put('alertType', $alertType);
}
/**
*文件大小转换
* @param string $size 原始大小
* @return string 转换大小
*/
public static function convertSize($size)
{
$units = array(' B', ' KB', ' MB', ' GB', ' TB');
for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
return @round($size, 2).$units[$i];
}
/**
* 获取包屑导航栏路径
* @param $key
* @param $pathArr
* @return string
*/
public static function getUrl($key,$pathArr)
{
$pathArr = array_slice($pathArr,0,$key);
$url= '';
foreach ($pathArr as $param) {
$url .= '-'.$param;
}
return trim($url,'-');
}
/**
* 获取上一级 Url
* @param $pathArr
* @return string
*/
public static function getParentUrl($pathArr)
{
array_pop($pathArr);
if (count($pathArr) == 0)
{
return '';
}
$url= '';
foreach ($pathArr as $param) {
$url .= '-'.$param;
}
return trim($url,'-');
}
/**
* 字符串截取,支持中文和其他编码
*
* @param string $str 需要转换的字符串
* @param integer $start 开始位置
* @param string $length 截取长度
* @param boolean $suffix 截断显示字符
* @param string $charset 编码格式
* @return string
*/
public static function subStr($str, $start, $length, $suffix = true, $charset = "utf-8")
{
$slice = mb_substr($str, $start, $length, $charset);
$omit = mb_strlen($str) >= $length ? '...' : '';
return $suffix ? $slice . $omit : $slice;
}
/**
* markdown 转 html
*
* @param string $markdown
* @return array
*/
public static function markdown2Html($markdown)
{
preg_match_all('/&lt;iframe.*iframe&gt;/', $markdown, $iframe);
// 如果有 i_frame 则先替换为临时字符串
if (!empty($iframe[0])) {
$tmp = [];
// 组合临时字符串
foreach ($iframe[0] as $k => $v) {
$tmp[] = '【iframe' . $k . '';
}
// 替换临时字符串
$markdown = str_replace($iframe[0], $tmp, $markdown);
// 转义 i_frame
$replace = array_map(function ($v) {
return htmlspecialchars_decode($v);
}, $iframe[0]);
}
// markdown转html
$parser = new Parser();
$html = $parser->makeHtml($markdown);
$html = str_replace('<code class="', '<code class="lang-', $html);
// 将临时字符串替换为 i_frame
if (!empty($iframe[0])) {
$html = str_replace($tmp, $replace, $html);
}
return $html;
}
/**
* 读取配置
* @param string $key
* @param string $default
* @return mixed|string
*/
public static function config($key = '',$default = '')
{
// 读取配置缓存
$config = Cache::remember('config', 1440, function () {
return Parameter::query()->pluck('value', 'name')->toArray();
});
return $key ? ($config[$key] ?: $default) : $config;
}
/**
* 获取文件图片
* @param $ext
* @return string
*/
public static function getExtIcon($ext)
{
$patterns = [
'stream'=>['fa-file-text-o',['txt','log']],
'image' => ['fa-file-image-o',['bmp','jpg','jpeg','png','gif']],
'video' => ['fa-file-video-o',['mkv','mp4']],
'audio' => ['fa-file-audio-o',['mp3']],
'code' => ['fa-file-code-o',['html','htm', 'css', 'go','java','js','json','txt','sh','md']],
'doc' => ['fa-file-word-o',['csv','doc','docx','odp','ods','odt','pot','potm','potx','pps','ppsx','ppsxm','ppt','pptm','pptx','rtf','xls','xlsx']],
'pdf' => ['fa-file-pdf-o',['pdf']],
'zip' => ['fa-file-archive-o',['zip','7z','rar','bz','gz']],
'android' => ['fa-android',['apk']],
'exe' => ['fa-windows',['exe','msi']],
];
$icon = '';
foreach ($patterns as $key => $suffix) {
if(in_array($ext,$suffix[1])){
$icon = $patterns[$key][0];
break;
} else {
$icon = 'fa-file-text-o';
}
}
return $icon;
}
}

0 comments on commit d37f364

Please sign in to comment.
You can’t perform that action at this time.