diff --git a/app/controller/admin.php b/app/controller/admin.php index d364a67..a7629e2 100644 --- a/app/controller/admin.php +++ b/app/controller/admin.php @@ -96,6 +96,7 @@ class AdminController extends BaseController { $enablehistory = (bool)$request->params()->query('enablehistory', 0); $history_name = $request->params()->query('history_name', app('history_name')); $enablephotoshare = (bool)$request->params()->query('enablephotoshare', 0); + $custom_media_share_host = $request->params()->query('custom_media_share_host', share_api_host()); $cronpw = $request->params()->query('cronpw', app('cronjob_pw')); $enablepwa = (bool)$request->params()->query('enablepwa', 0); @@ -113,6 +114,7 @@ class AdminController extends BaseController { 'history_enable' => $enablehistory, 'history_name' => $history_name, 'enable_media_share' => $enablephotoshare, + 'custom_media_share_host' => $custom_media_share_host, 'cronjob_pw' => $cronpw, 'pwa_enable' => $enablepwa ]; diff --git a/app/controller/share.php b/app/controller/share.php index ac76cd4..9347f0a 100644 --- a/app/controller/share.php +++ b/app/controller/share.php @@ -54,7 +54,7 @@ class ShareController extends BaseController { $mailobj = new Asatru\SMTPMailer\SMTPMailer(); $mailobj->setRecipient($user->get('email')); $mailobj->setSubject(__('app.mail_share_photo_title')); - $mailobj->setView('mail/share_photo', [], ['url_photo' => $result->data->url, 'url_asset' => $result->data->asset, 'url_removal' => env('APP_SERVICE_URL') . '/api/photo/remove?ident=' . $result->data->ident . '&ret=home']); + $mailobj->setView('mail/share_photo', [], ['url_photo' => $result->data->url, 'url_asset' => $result->data->asset, 'url_removal' => share_api_host() . '/api/photo/remove?ident=' . $result->data->ident . '&ret=home']); $mailobj->setProperties(mail_properties()); $mailobj->send(); diff --git a/app/helper/AppHelper.php b/app/helper/AppHelper.php index b512972..a0499ee 100644 --- a/app/helper/AppHelper.php +++ b/app/helper/AppHelper.php @@ -100,4 +100,17 @@ function workspace_url($path) function abs_photo($asset) { return UtilsModule::absolutePhoto($asset); +} + +/** + * @return string + */ +function share_api_host() +{ + $host = app('custom_media_share_host'); + if ((is_string($host)) && (strlen($host) > 0)) { + return $host; + } + + return env('APP_SERVICE_URL'); } \ No newline at end of file diff --git a/app/lang/de/app.php b/app/lang/de/app.php index fd28dba..44e3c7d 100644 --- a/app/lang/de/app.php +++ b/app/lang/de/app.php @@ -440,5 +440,6 @@ return [ 'add_location_log_entry' => 'Eintrag hinzufügen', 'edit_location_log_entry' => 'Eintrag bearbeiten', 'confirm_remove_location_log_entry' => 'Soll dieser Eintrag wirklich gelöscht werden?', - 'no_location_log_entries_yet' => 'Noch keine Einträge.' + 'no_location_log_entries_yet' => 'Noch keine Einträge.', + 'share_api_host' => 'Server zum Teilen von Fotos' ]; \ No newline at end of file diff --git a/app/lang/en/app.php b/app/lang/en/app.php index 228a560..aeeee67 100644 --- a/app/lang/en/app.php +++ b/app/lang/en/app.php @@ -440,5 +440,6 @@ return [ 'add_location_log_entry' => 'Add entry', 'edit_location_log_entry' => 'Edit entry', 'confirm_remove_location_log_entry' => 'Do you really want to remove this entry?', - 'no_location_log_entries_yet' => 'No entries yet.' + 'no_location_log_entries_yet' => 'No entries yet.', + 'share_api_host' => 'Host to share images on' ]; \ No newline at end of file diff --git a/app/migrations/AppModel.php b/app/migrations/AppModel.php index 71c49c0..666c199 100644 --- a/app/migrations/AppModel.php +++ b/app/migrations/AppModel.php @@ -40,6 +40,7 @@ class AppModel_Migration { $this->database->add('history_enable BOOLEAN NOT NULL DEFAULT 1'); $this->database->add('history_name VARCHAR(512) NULL DEFAULT \'History\''); $this->database->add('enable_media_share BOOLEAN NOT NULL DEFAULT 0'); + $this->database->add('custom_media_share_host VARCHAR(1024) NULL'); $this->database->add('cronjob_pw VARCHAR(512) NOT NULL DEFAULT \'\''); $this->database->add('overlay_alpha VARCHAR(512) NULL'); $this->database->add('smtp_fromname VARCHAR(512) NULL'); diff --git a/app/modules/ApiModule.php b/app/modules/ApiModule.php index 50afbd2..b2f25f6 100644 --- a/app/modules/ApiModule.php +++ b/app/modules/ApiModule.php @@ -27,7 +27,7 @@ class ApiModule { $file = public_path() . '/img/' . PlantPhotoModel::getItem($asset)->get('original'); } - $ch = curl_init(env('APP_SERVICE_URL') . '/api/photo/share'); + $ch = curl_init(share_api_host() . '/api/photo/share'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); @@ -63,7 +63,7 @@ class ApiModule { public static function removePhoto($ident) { try { - $ch = curl_init(env('APP_SERVICE_URL') . '/api/photo/remove'); + $ch = curl_init(share_api_host() . '/api/photo/remove'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); diff --git a/app/views/admin.php b/app/views/admin.php index ee714c3..a461184 100644 --- a/app/views/admin.php +++ b/app/views/admin.php @@ -131,6 +131,13 @@ +
+ +
+ +
+
+
diff --git a/app/views/layout.php b/app/views/layout.php index 79edb97..6959dee 100644 --- a/app/views/layout.php +++ b/app/views/layout.php @@ -1082,7 +1082,7 @@