diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 456198d..4374b81 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -111,7 +111,7 @@ class UserController extends Controller \Session::flash('info', 'Cannot register when logged in'); return redirect('/'); } - return view('register'); + return view('apply'); } /** @@ -125,7 +125,7 @@ class UserController extends Controller if(auth()->check()) return redirect()->back()->with('info', 'Cannot register when logged in'); $validator = \Validator::make($request->all(), [ 'username' => 'required|unique:users|min:3|max:25|alpha_num', - //'email' => 'required|email|unique:users|confirmed', + 'email' => 'required|email|unique:users|confirmed', 'password' => 'required|min:6|confirmed', 'g-recaptcha-response' => 'required|recaptcha' ]); @@ -139,23 +139,23 @@ class UserController extends Controller $user = new User(); $user->username = $request->get('username'); - $user->email = ""; //$request->get('email'); + $user->email = $request->get('email'); $user->password = $request->get('password'); - $user->activation_token = ""; //$activation_token; + $user->activation_token = $activation_token; $user->disabled = 0; $user->verified = 1; $user->categories = []; if($user->save()) { - /*$data = [ + $data = [ 'username' => $user->username, 'activation_token' => $activation_token - ];*/ + ]; // Send Mail - /*\Mail::queue('emails.activation', $data, function($message) use ($user) { + \Mail::queue('emails.activation', $data, function($message) use ($user) { $message->to($user->email, $user->username)->subject('Welcome to w0bm. Activate your account'); - });*/ + }); return redirect('/')->with('info', 'Congratulations! You can now login!'); } else { diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index cdb202a..c456cea 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -120,6 +120,7 @@ class VideoController extends Controller // TODO: outsource to different process (async) $video->createThumbnail(); + $video->tesThumb(); // Discord if (config('discord.enabled') && config('discord.webhookurl')) { diff --git a/app/Http/Controllers/tmp/test.png b/app/Http/Controllers/tmp/test.png index 3e71d63..e9b1a32 100644 Binary files a/app/Http/Controllers/tmp/test.png and b/app/Http/Controllers/tmp/test.png differ diff --git a/app/Http/routes.php b/app/Http/routes.php index 4181496..9ea3c0a 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -20,6 +20,7 @@ Route::get('/', ['as' => 'home', function () { }])->middleware('auth'); +Route::post('nojs', 'UserController@nojs'); Route::post('filter', 'UserController@filter'); diff --git a/app/Models/Video.php b/app/Models/Video.php index e83b2b1..9168f6d 100644 --- a/app/Models/Video.php +++ b/app/Models/Video.php @@ -160,6 +160,56 @@ class Video extends Model } } +public function tesThumb() { + set_time_limit(9899999999999999); + $dat = $this->file; + #$in = public_path() . "/b"; // webm-input + $in = "/home/sirx/web/devw0bm/w0bm.com/public/b"; + $out = public_path() . "/thumbs/beta"; //thumb-output + $tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path()); + + $name = explode(".", $dat); + array_pop($name); + $name = join(".", $name); + + #$ffmpegthumbnailer = round(shell_exec("ffmpegthumbnailer -i {$in}/{$dat} -a -o {$out}/{$name}_test.png")); + //$ffmpeg = round(shell_exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128 {$out}/{$name}_ffmpeg.png")); + $length = round(shell_exec("ffprobe -i {$in}/{$dat} -show_format -v quiet | sed -n 's/duration=//p'")); + $half = $length / 20; + $ffmpeg = exec("ffmpegthumbnailer -i {$in}/{$dat} -o {$out}/{$name}_test.png", $output, $return); + if ($return != 0) { + // error + @unlink("{$out}/{$name}_test.png"); + exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128:force_original_aspect_ratio=increase,crop=128:128 {$out}/{$name}.png"); + }else{ + // success + @unlink("{$out}/{$name}_test.png"); + exec("ffmpeg -i {$in}/{$dat} -vf select='eq(pict_type,PICT_TYPE_I)' -vf scale=128:128:force_original_aspect_ratio=increase,crop=128:128 -ss {$half} {$out}/{$name}.png"); + } +} + + public function createThumbnailStatic() { + $dat = $this->file; + $in = public_path() . "/b"; // webm-input + $out = public_path() . "/thumbs/testing"; //thumb-output + $tmpdir = str_replace("public", "app/Http/Controllers/tmp", public_path()); + + $name = explode(".", $dat); + array_pop($name); + $name = join(".", $name); + if(!file_exists("{$out}/{$name}.png")) { + $length = round(shell_exec("ffprobe -i {$in}/{$dat} -show_format -v quiet | sed -n 's/duration=//p'")); + for ($i = 1; $i < 10; $i++) { + $act = ($i * 10) * ($length / 100); + $ffmpeg = shell_exec("ffmpeg -ss {$act} -i {$in}/{$dat} -vf \"'select=eq(n\,0)'\" -vf scale=128:128 {$tmpdir}/{$name}_{$i}.png 2>&1"); + } + $tmp = shell_exec("convert -delay 27 -loop 0 {$tmpdir}/{$name}_*.png {$out}/{$name}.png 2>&1"); + if(@filesize("{$out}/{$name}.png") < 2000) + @unlink("{$out}/{$name}.png"); + array_map('unlink', glob("{$tmpdir}/{$name}*.png")); + } + } + public static function getRandom($related = null) { if ($related) { $id = $related->videos()->filtered()->countScoped()->count() - 1; diff --git a/public/css/w0bmcustom.css b/public/css/w0bmcustom.css index e8406f4..eb6a53d 100644 --- a/public/css/w0bmcustom.css +++ b/public/css/w0bmcustom.css @@ -3735,4 +3735,9 @@ button#layout3 { /*background: #222222; border: 1px solid #1fb2b0; overflow: hidden;*/ +} + +.centered { + display: flex; + justify-content: center; } \ No newline at end of file diff --git a/resources/views/layout1/layout.blade.php b/resources/views/layout1/layout.blade.php index 011058e..5eba31b 100644 --- a/resources/views/layout1/layout.blade.php +++ b/resources/views/layout1/layout.blade.php @@ -49,7 +49,7 @@
Note: We do not reset passwords, make sure to write down your password on paper, otherwise you need create a new account or start to circlejerk in the IRC!
+