diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index 886c772..2e33b18 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -20,12 +20,13 @@ class DomainController extends Controller { if ($request->post()) { $request->validate([ - 'name' => 'required|unique:domains|max:8', - 'dnsdomain' => 'nullable|unique:domains|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', + 'name' => 'required|max:8|unique:domains,name,'.$o->id, + 'dnsdomain' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i|unique:domains,dnsdomain,'.$o->id, 'active' => 'required', + 'public' => 'required', ]); - foreach (['name','dnsdomain','active','notes'] as $key) + foreach (['name','dnsdomain','active','public','homepage','notes'] as $key) $o->{$key} = $request->post($key); $o->save(); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 028a629..51dc6e3 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,12 +2,13 @@ namespace App\Http\Controllers; +use App\Models\Domain; + class HomeController extends Controller { - public function network(string $name) + public function network(Domain $o) { - return view('networks') - ->with('content',$name) - ->with('network',$name); + return view('domain.view') + ->with('o',$o); } } \ No newline at end of file diff --git a/app/Models/Domain.php b/app/Models/Domain.php index f5bbfe6..2b6f160 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -10,10 +10,32 @@ class Domain extends Model { use ScopeActive; + /* SCOPES */ + + /** + * Only query active records + */ + public function scopePublic($query) + { + return $query->where('public',TRUE); + } + /* RELATIONS */ public function zones() { return $this->hasMany(Zone::class); } + + /* CASTS */ + + public function getHomePageAttribute($value) + { + return $value ? gzuncompress(base64_decode($value)) : 'No available information at the moment.'; + } + + public function setHomePageAttribute($value) + { + $this->attributes['homepage'] = base64_encode(gzcompress($value,9)); + } } \ No newline at end of file diff --git a/app/Models/Zone.php b/app/Models/Zone.php index 29ace2e..245b90f 100644 --- a/app/Models/Zone.php +++ b/app/Models/Zone.php @@ -17,13 +17,5 @@ class Zone extends Model return $this->belongsTo(Domain::class); } - /* SCOPES */ - /** - * Only query active records - */ - public function scopePublic() - { - return $this->where('public',TRUE); - } } \ No newline at end of file diff --git a/app/Traits/ScopeActive.php b/app/Traits/ScopeActive.php index 08f44f9..d140dc7 100644 --- a/app/Traits/ScopeActive.php +++ b/app/Traits/ScopeActive.php @@ -10,8 +10,8 @@ trait ScopeActive /** * Only query active records */ - public function scopeActive() + public function scopeActive($query) { - return $this->where($this->getTable().'.active',TRUE); + return $query->where($this->getTable().'.active',TRUE); } } diff --git a/database/migrations/2021_06_14_064423_add_public_to_domains.php b/database/migrations/2021_06_14_064423_add_public_to_domains.php new file mode 100644 index 0000000..ddc2a43 --- /dev/null +++ b/database/migrations/2021_06_14_064423_add_public_to_domains.php @@ -0,0 +1,40 @@ +boolean('public')->default(TRUE); + $table->text('homepage')->nullable(); + }); + + Schema::table('zones', function (Blueprint $table) { + $table->dropColumn('public'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('domains', function (Blueprint $table) { + $table->dropColumn(['public','homepage']); + }); + Schema::table('zones', function (Blueprint $table) { + $table->boolean('public')->default(TRUE); + }); + } +} diff --git a/public/oldschool/css/main.css b/public/oldschool/css/main.css index 5363d12..0b578d9 100644 --- a/public/oldschool/css/main.css +++ b/public/oldschool/css/main.css @@ -41,6 +41,9 @@ textarea { a:link { text-decoration:none } +a.disabled { + pointer-events: none; +} .cap { text-transform:uppercase @@ -261,6 +264,11 @@ ul#navlist-desktop { text-shadow: 2px 2px 0 #555; border-bottom: 2px solid #aaa; } +#content h1>small { + font-size: 35%; + color: #403f3f; + text-shadow: none; +} #content h2 { color:#fff; background-color:#a00; @@ -298,10 +306,7 @@ ul#navlist-desktop { color:#c60; } -#content>div.row:first-child { - padding-top: 0px; -} -#content>div.row { +#content>div.row:not(:first-child) { padding-top: 20px; } @@ -412,6 +417,9 @@ form div.row { .greyframe>form>div.row:last-child { padding-bottom: 15px; } +.greyframe div.row div[class^="col-"]:not(:first-child) { + padding-left: 20px; +} label.form-label { font-size: 75%; @@ -458,6 +466,23 @@ div p:last-child { margin: auto; } +pre, +pre code { + font-family:ibmbios2y,monospace; + font-size:14px; + color: #ccc; + margin:0; + padding: 0 0 20px 0; + font-weight:400; + text-align:left; + white-space:pre-wrap; + white-space:-moz-pre-wrap; + white-space:-pre-wrap; + white-space:-o-pre-wrap; + word-wrap:break-word; + text-indent:initial +} + .row { text-align: left; } @@ -549,6 +574,9 @@ tbody { border-bottom:1px solid #666 } +.push-right { + float:right; +} .text-center { text-align:center; } diff --git a/resources/views/about.blade.php b/resources/views/about.blade.php index 6821138..c6b72d8 100644 --- a/resources/views/about.blade.php +++ b/resources/views/about.blade.php @@ -1,4 +1,7 @@ @extends('layouts.app') +@section('htmlheader_title') + About +@endsection @section('content')