From cb3beaedd9c42a9488388f1a0a26c55c410c20ef Mon Sep 17 00:00:00 2001 From: Rhilip Date: Wed, 11 Sep 2019 10:26:24 +0800 Subject: [PATCH] style(dir): move apps\public to top dir 1. revert part of commit e6394a6d : move rid-httpd back to bin/rid-httpd 2. move apps\public to top dir --- .bowerrc | 2 +- CHANGELOG.md | 6 ++++-- README.md | 2 +- apps/controllers/CaptchaController.php | 2 +- rid-httpd => bin/rid-httpd | 9 ++++++--- composer.json | 6 +++--- migration/ridpt.nginx.conf | 12 ++++++------ {apps/public => public}/.htaccess | 0 {apps/public => public}/favicon.ico | Bin {apps/public => public}/lib/.gitignore | 0 {apps/public => public}/robots.txt | 0 .../static/avatar/default_avatar.jpg | Bin {apps/public => public}/static/css/error.css | 0 {apps/public => public}/static/css/main.css | 0 .../static/fonts/Times New Roman.ttf | Bin {apps/public => public}/static/js/main.js | 0 {apps/public => public}/static/json/README.md | 0 {apps/public => public}/static/json/ext2Icon.json | 0 .../public => public}/static/pic/captcha_dummy.png | Bin .../static/pic/category_sprite.png | Bin {apps/public => public}/static/pic/logo.png | Bin 21 files changed, 22 insertions(+), 17 deletions(-) rename rid-httpd => bin/rid-httpd (87%) rename {apps/public => public}/.htaccess (100%) rename {apps/public => public}/favicon.ico (100%) rename {apps/public => public}/lib/.gitignore (100%) rename {apps/public => public}/robots.txt (100%) rename {apps/public => public}/static/avatar/default_avatar.jpg (100%) rename {apps/public => public}/static/css/error.css (100%) rename {apps/public => public}/static/css/main.css (100%) rename {apps/public => public}/static/fonts/Times New Roman.ttf (100%) rename {apps/public => public}/static/js/main.js (100%) rename {apps/public => public}/static/json/README.md (100%) rename {apps/public => public}/static/json/ext2Icon.json (100%) rename {apps/public => public}/static/pic/captcha_dummy.png (100%) rename {apps/public => public}/static/pic/category_sprite.png (100%) rename {apps/public => public}/static/pic/logo.png (100%) diff --git a/.bowerrc b/.bowerrc index 9166bd2..a1d7019 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory": "apps/public/lib" + "directory": "public/lib" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ec809da..cbefad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,13 @@ - **template:** Add git commit hash in `CHANGELOG.md` (76bc527) ### Feat +- **Auth:** Sep Auth part from Site to new components (f36884e) - **Auth:** Use JWT to set cookies content (bf897c6) - **Auth:** Add Auth By passkey support for special route (aff1f87) -- **Auth:** Sep Auth part from Site to new components (f36884e) - **Auth/Login:** Add full Advanced Options support (6009dc8) -- **Secret:** Check session and user_id match or not in jwt payload (358ba5d) +- **Bonus:** Pre-Add Bonus system (59ddd39) - **Secret:** Protect jwt key for env('APP_SECRET_KEY') (dfa67da) +- **Secret:** Check session and user_id match or not in jwt payload (358ba5d) - **Sessions:** record user access information at Auth->onRequestAfter() (e2a22a7) - **Sessions/List:** Use SessionsListForm to show user sessions (9ecfb97) - **Site:** Add page Site/{Logs,Rules} (65cea9e) @@ -57,6 +58,7 @@ - **Redis:** Remove view in redis , use other software install (c5d3378) ### Style +- **EnvironmentLoader:** Use Dotenv to load Loads environment variables (1fea316) - **Redis:** rewrite namespace of cache keys (0c4e1a2) diff --git a/README.md b/README.md index 4e72d68..38b673d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ edit in Admin Panel. 5. Run Test by `php bin/rid-httpd service start -u` , And Congratulation If you see those output **without error throwout**. ```bash - root@ridpt:/data/wwwroot/ridpt.rhilip.info# php rid-httpd service start + root@ridpt:/data/wwwroot/ridpt.rhilip.info# php bin/rid-httpd service start ____ __ ____ ______ /\ _`\ __ /\ \/\ _`\ /\__ _\ \ \ \L\ \/\_\ \_\ \ \ \L\ \/_/\ \/ diff --git a/apps/controllers/CaptchaController.php b/apps/controllers/CaptchaController.php index ac0a5c0..1914313 100644 --- a/apps/controllers/CaptchaController.php +++ b/apps/controllers/CaptchaController.php @@ -18,7 +18,7 @@ public function actionIndex() $captcha = new Captcha([ 'width' => 150, 'height' => 40, - 'fontFile' => app()->getPublicPath() . '/static/fonts/Times New Roman.ttf', + 'fontFile' => RIDPT_ROOT . '/public/static/fonts/Times New Roman.ttf', // FIXME 'fontSize' => 20, 'wordNumber' => 6, 'angleRand' => [-20, 20], diff --git a/rid-httpd b/bin/rid-httpd similarity index 87% rename from rid-httpd rename to bin/rid-httpd index a3b033f..367c871 100644 --- a/rid-httpd +++ b/bin/rid-httpd @@ -7,6 +7,7 @@ * @author Rhilip */ +define('RIDPT_ROOT', dirname(__DIR__)); define('RIDPT_START', microtime(true)); /* @@ -20,7 +21,7 @@ define('RIDPT_START', microtime(true)); * loading any of our classes later on. It feels great to relax. * */ -require __DIR__ . '/vendor/autoload.php'; +require RIDPT_ROOT . '/vendor/autoload.php'; /* * -------------------------------------------------------------------------- @@ -35,14 +36,16 @@ if (!PHP_SAPI === 'cli') * Load Environment variables * -------------------------------------------------------------------------- */ -$dotenv = Dotenv\Dotenv::create(__DIR__); +$dotenv = Dotenv\Dotenv::create(RIDPT_ROOT); $dotenv->load(); +env(); + /* * -------------------------------------------------------------------------- * Start Swoole Server * -------------------------------------------------------------------------- */ -$config = require __DIR__ . '/apps/config/httpd.php'; +$config = require RIDPT_ROOT . '/apps/config/httpd.php'; $exitCode = (new Rid\Console\Application($config))->run(); exit($exitCode); diff --git a/composer.json b/composer.json index 1e85097..01ea2f1 100644 --- a/composer.json +++ b/composer.json @@ -41,12 +41,12 @@ }, "autoload": { "psr-4": { - "Rid\\": "Framework/", + "Rid\\": "framework/", "apps\\": "apps/" }, "files": [ - "Framework/Rid.php", - "Framework/functions.php" + "framework/Rid.php", + "framework/functions.php" ] }, "repositories": { diff --git a/migration/ridpt.nginx.conf b/migration/ridpt.nginx.conf index 9fbb3bc..b7cf0ae 100644 --- a/migration/ridpt.nginx.conf +++ b/migration/ridpt.nginx.conf @@ -4,17 +4,17 @@ server #listen [::]:80; server_name ridpt.top ridpt.rhilip.info; index index.html index.htm index.php default.html default.htm default.php; - root /data/wwwroot/ridpt.top/apps/public/; + root /data/wwwroot/ridpt.top/public/; #error_page 404 /404.html; # Deny access to PHP files in specific directory location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } - + # Don't Log the access log of robots.txt or favicon.ico location = /robots.txt { allow all; log_not_found off; access_log off; } location = /favicon.ico { allow all; log_not_found off; access_log off; } - + # security headers #add_header X-Frame-Options "SAMEORIGIN" always; #add_header X-XSS-Protection "1; mode=block" always; @@ -22,7 +22,7 @@ server #add_header Referrer-Policy "no-referrer-when-downgrade" always; #add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; #add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; - + location = / { rewrite ^(.*)$ /index last; } @@ -38,7 +38,7 @@ server proxy_pass http://127.0.0.1:9501; } } - + # assets, media location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ { expires 7d; @@ -51,7 +51,7 @@ server expires 7d; access_log off; } - + # ACME-challenge location ~ /.well-known { allow all; diff --git a/apps/public/.htaccess b/public/.htaccess similarity index 100% rename from apps/public/.htaccess rename to public/.htaccess diff --git a/apps/public/favicon.ico b/public/favicon.ico similarity index 100% rename from apps/public/favicon.ico rename to public/favicon.ico diff --git a/apps/public/lib/.gitignore b/public/lib/.gitignore similarity index 100% rename from apps/public/lib/.gitignore rename to public/lib/.gitignore diff --git a/apps/public/robots.txt b/public/robots.txt similarity index 100% rename from apps/public/robots.txt rename to public/robots.txt diff --git a/apps/public/static/avatar/default_avatar.jpg b/public/static/avatar/default_avatar.jpg similarity index 100% rename from apps/public/static/avatar/default_avatar.jpg rename to public/static/avatar/default_avatar.jpg diff --git a/apps/public/static/css/error.css b/public/static/css/error.css similarity index 100% rename from apps/public/static/css/error.css rename to public/static/css/error.css diff --git a/apps/public/static/css/main.css b/public/static/css/main.css similarity index 100% rename from apps/public/static/css/main.css rename to public/static/css/main.css diff --git a/apps/public/static/fonts/Times New Roman.ttf b/public/static/fonts/Times New Roman.ttf similarity index 100% rename from apps/public/static/fonts/Times New Roman.ttf rename to public/static/fonts/Times New Roman.ttf diff --git a/apps/public/static/js/main.js b/public/static/js/main.js similarity index 100% rename from apps/public/static/js/main.js rename to public/static/js/main.js diff --git a/apps/public/static/json/README.md b/public/static/json/README.md similarity index 100% rename from apps/public/static/json/README.md rename to public/static/json/README.md diff --git a/apps/public/static/json/ext2Icon.json b/public/static/json/ext2Icon.json similarity index 100% rename from apps/public/static/json/ext2Icon.json rename to public/static/json/ext2Icon.json diff --git a/apps/public/static/pic/captcha_dummy.png b/public/static/pic/captcha_dummy.png similarity index 100% rename from apps/public/static/pic/captcha_dummy.png rename to public/static/pic/captcha_dummy.png diff --git a/apps/public/static/pic/category_sprite.png b/public/static/pic/category_sprite.png similarity index 100% rename from apps/public/static/pic/category_sprite.png rename to public/static/pic/category_sprite.png diff --git a/apps/public/static/pic/logo.png b/public/static/pic/logo.png similarity index 100% rename from apps/public/static/pic/logo.png rename to public/static/pic/logo.png