A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
reverb generate keys only if not existing
aminnausindd81457419ad
diff --git a/app/Console/Commands/GenerateReverbKeys.php b/app/Console/Commands/GenerateReverbKeys.phpindex 5e9dc919..daab302a 100644--- a/app/Console/Commands/GenerateReverbKeys.php+++ b/app/Console/Commands/GenerateReverbKeys.php@@ -23,25 +23,31 @@ class GenerateReverbKeys extends Command {* Execute the console command.*/public function handle() {+ $envPath = base_path('.env');++ if (! file_exists($envPath)) {+ return false;+ }++ if ($this->keysExist()) {+ return false;+ }+$reverbAppId = random_int(100000, 999999);$reverbAppKey = bin2hex(random_bytes(16));$reverbAppSecret = bin2hex(random_bytes(16));- $this->setEnvironmentValue('REVERB_APP_ID', $reverbAppId);- $this->setEnvironmentValue('REVERB_APP_KEY', $reverbAppKey);- $this->setEnvironmentValue('REVERB_APP_SECRET', $reverbAppSecret);+ $this->setEnvironmentValue('REVERB_APP_ID', $reverbAppId, $envPath);+ $this->setEnvironmentValue('REVERB_APP_KEY', $reverbAppKey, $envPath);+ $this->setEnvironmentValue('REVERB_APP_SECRET', $reverbAppSecret, $envPath);$this->info('Reverb keys generated and updated in .env file.');}// Helper method to set the values in the .env file- protected function setEnvironmentValue($key, $value) {+ protected function setEnvironmentValue($key, $value, $envPath) {$envPath = base_path('.env');- if (! file_exists($envPath)) {- return;- }-$content = file_get_contents($envPath);$pattern = "/^$key=[^\n]*/m";$replacement = "$key=$value";@@ -52,4 +58,20 @@ class GenerateReverbKeys extends Command {file_put_contents($envPath, $newContent);}}++ protected function keysExist() {+ $reverbAppId = (int) env('REVERB_APP_ID');+ $reverbAppKey = env('REVERB_APP_KEY', '');+ $reverbAppSecret = env('REVERB_APP_SECRET', '');++ if ($reverbAppId < 100000 || $reverbAppId > 999999) {+ return false;+ }++ if (strlen($reverbAppKey) < 20 || strlen($reverbAppSecret) < 20) {+ return false;+ }++ return true;+ }}