diff --git a/app/Http/Controllers/BashController.php b/app/Http/Controllers/BashController.php index 7ed0d25..09ff50d 100644 --- a/app/Http/Controllers/BashController.php +++ b/app/Http/Controllers/BashController.php @@ -8,14 +8,67 @@ use Illuminate\Support\Facades\Log; class BashController extends Controller { public function exec (Request $r) { // /api/rpc/bash/exec - if ($r->arg[0] == 'ls') { - return $this->ls($r->arg[2], $r->arg[1]); + if (strlen($r->args) == 0) return ''; + $args = explode(' ', $r->args); + if ($args[0] == 'ls') { + return $this->ls($args); + } + else if ($args[0] == 'cat') { + return $this->cat($args); } - return ; + return '不明なコマンドです。: '.$args[0]; } - public function ls($pwd='', $opt='') { - return 'page forum user'; + public function ls ($args) { + $opt = ''; + $pwd = ''; + + for ($i = 1; $i < count($args); $i++) { + if (mb_substr($args[$i], 0, 1, 'utf-8')) $opt = $args[$i]; + } + + if (strpos($opt, 'l') !== false) { + $ps = null; + $pg = null; + + if (strpos($opt, 't') !== false) { + $pg = DB::table('blg_content')->select('publish_date')->where('isPost', 0)->orderBy('title', 'asc')->first(); + $ps = DB::table('blg_content')->select('publish_date')->where('isPost', 1)->orderBy('title', 'asc')->first(); + } + else { + $pg = DB::table('blg_content')->select('publish_date')->where('isPost', 0)->orderBy('publish_date', 'desc')->first(); + $ps = DB::table('blg_content')->select('publish_date')->where('isPost', 1)->orderBy('publish_date', 'desc')->first(); + } + + return "合計 2
+drwxr-xr-x 2 suwako suwako ".(strpos($opt, 'h') !== false ? '4.0K' : '4096')." ".date('m', $ps->publish_date)."月 ".date('d', $ps->publish_date)." ".date('H:i', $ps->publish_date)." post
+drwxr-xr-x 2 suwako suwako ".(strpos($opt, 'h') !== false ? '4.0K' : '4096')." ".date('m', $pg->publish_date)."月 ".date('d', $pg->publish_date)." ".date('H:i', $pg->publish_date)." page"; + } + + return 'post page'; + } + + public function cat ($args) { + if (isset($args[1])) { + $cat = explode('/', $args[1]); + $txt = null; + $mode = 0; + $slug = ''; + + for ($i = 1; $i < count($cat); $i++) { + if (strpos($cat[$i], 'post') !== false) $mode = 1; + $slug = $cat[$i]; + } + + $txt = DB::table('blg_content')->select('title', 'message')->where('slug', $slug)->where('isPost', $mode)->first(); + + if ($txt) { + return ">>".$txt->title."<<

+".$txt->message; + } + } + + return ''; } } diff --git a/resources/js/components/bash.vue b/resources/js/components/bash.vue index 18a3377..600201c 100644 --- a/resources/js/components/bash.vue +++ b/resources/js/components/bash.vue @@ -2,6 +2,7 @@ ロリ端末 + @@ -33,6 +42,8 @@ export default { data: function () { return { + cmd: [''], + output: ['ロリコマンドラインですね〜♡'], show: false, width: 0, height: 0, @@ -50,6 +61,12 @@ onDrag: function (x, y) { this.x = x this.y = y + }, + exec (i) { + axios.post('/api/rpc/bash/exec', { args: this.cmd[i] }).then(res => { + this.output.push(res.data); + this.cmd.push(''); + }); } } } @@ -145,8 +162,8 @@ right: 0; } - .konsoleuser { background: url('/img/bash/user_bg.png') repeat; } - .konsoleroot { background: url('/img/bash/root_bg.png') repeat; } + .konsoleuser { background: url('/img/bash/user_bg.png') repeat; cursor: text; } + .konsoleroot { background: url('/img/bash/root_bg.png') repeat; cursor: text; } .vdr { background-size: cover; @@ -199,4 +216,14 @@ right: 0; bottom: 0; } + + .konsole_input, .konsole_input:focus, .konsole_input:disabled { + width: 100%; + background: transparent; + border-color: transparent; + outline: none; + caret-color: #fcfcfc; + color: #fcfcfc; + line-height: 14px; + } diff --git a/resources/sass/app.scss b/resources/sass/app.scss index 9083ab5..23849a0 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -19,6 +19,13 @@ background-color: #232629; } + .indexborder { + border: 2px solid #3daee9; + box-shadow: 0px 0px 7px 3px #1d99f3; + padding: 8px; + background-color: #31363b; + } + .logo-img { border: 2px solid #3daee9; box-shadow: 0 0 7px 3px #1d99f3; @@ -60,9 +67,7 @@ /// @param {Integer} $stroke - Stroke width /// @param {Color} $color - Stroke color /// @return {Style} - text-shadow - @mixin stroke($stroke, $color) { - text-shadow: stroke($stroke, $color); - } + @mixin stroke($stroke, $color) { text-shadow: stroke($stroke, $color); } @keyframes sitenamehover { 0% { text-shadow: stroke(4, #1d99f3); } @@ -82,61 +87,37 @@ text-shadow: stroke(4, #1d99f3); } - .logo-c:hover { - animation: sitenamehover 2s linear infinite; - } - - @media (max-width : 1200px) { - .logo-c { font-size: 32px; } - } - - @media (max-width : 968px) { - .logo-c { font-size: 20px; } - } - - @media (max-width : 525px) { - .logo-br, .nomobile { display: none; } - } + .logo-c:hover { animation: sitenamehover 2s linear infinite; } + @media (max-width : 1200px) { .logo-c { font-size: 32px; } } + @media (max-width : 968px) { .logo-c { font-size: 20px; } } + @media (max-width : 525px) { .logo-br, .nomobile { display: none; } } .sidemenu { border: 2px solid #3daee9; box-shadow: 0 0 7px 3px #1d99f3; } - a { - color: #1d99f3; - } - a:hover { - color: #3daee9; - } + a { color: #1d99f3; } + a:hover { color: #3daee9; } .bg-dark { - background: radial-gradient(farthest-corner at 50% 85%, - #3498db 0%, #232629 100%); + background: radial-gradient(farthest-corner at 50% 85%, #3498db 0%, #232629 100%); border: 2px solid #3daee9; box-shadow: 0 0 7px 3px #1d99f3; } - .navbar { - padding: 0px; - } - .navbar-toggler { - border: 0px solid transparent; - } + .navbar { padding: 0px; } + .navbar-toggler { border: 0px solid transparent; } .navbar-nav .dropdown-menu { background-color: #31363b; color: #fcfcfc; border: 2px solid #3daee9; box-shadow: 0 0 7px 3px #1d99f3; } - .dropdown-item { - color: #fcfcfc; - } + .dropdown-item { color: #fcfcfc; } .dropdown-item.active, .dropdown-item:active, .dropdown-item:hover, .dropdown-item:focus { color: #fcfcfc; background-color: #3daee9; } - .navbar-brand { - padding: 5px; - } + .navbar-brand { padding: 5px; } .navbar-brand, .nav-item { transition: background 0.3s, color 0.3s; border-radius: 2px; @@ -184,34 +165,18 @@ background-color: #31363b; text-align: left; } - .commentloop { - padding: 10px 4px 40px 4px; - } + + .commentloop { padding: 10px 4px 40px 4px; } .commentloop > .name { color: #11d116; } .modal-header, .modal-body, .modal-footer { color: #fcfcfc; } - .modal-header { - background: linear-gradient( - to bottom, - #1d99f3 0%, - #6ec0fb 34%, - #3daee9 100% - ); - } + .modal-header { background: linear-gradient(to bottom, #1d99f3 0%, #6ec0fb 34%, #3daee9 100%); } .modal-body { background-color: #4d4d4d; } .modal-footer { background-color: #31363b; } - .form-control, .form-control:focus { - background-color: #232629; - color: #fcfcfc; - } - .form-control { - border: 1px solid #34495e; - } - .form-control:focus { - border: 1px solid #3daee9; - } - .form-control:disabled, .form-control[readonly] { - background-color: #232629; - } + .form-control, .form-control:focus { background-color: #232629; color: #fcfcfc; } + .form-control { border: 1px solid #34495e; } + .form-control:focus { border: 1px solid #3daee9; } + .form-control:disabled, .form-control[readonly] { background-color: #232629; } + .custom-control-input:checked ~ .custom-control-label::before, .custom-radio .custom-control-input:checked ~ .custom-control-label::before, .custom-checkbox .custom-control-input:checked ~ .custom-control-label::before diff --git a/resources/views/pages/site/index.blade.php b/resources/views/pages/site/index.blade.php index 17b9395..5c44812 100644 --- a/resources/views/pages/site/index.blade.php +++ b/resources/views/pages/site/index.blade.php @@ -2,7 +2,7 @@ @section('content') -
+
@foreach ($res as $k => $r)
diff --git a/routes/api/bash.php b/routes/api/bash.php index f9d12c2..1a62981 100644 --- a/routes/api/bash.php +++ b/routes/api/bash.php @@ -1,4 +1,4 @@