mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-01-05 20:30:34 -06:00
#261 Define custom host for photo sharing
This commit is contained in:
@@ -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
|
||||
];
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
@@ -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'
|
||||
];
|
||||
@@ -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'
|
||||
];
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -131,6 +131,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">{{ __('app.share_api_host') }}</label>
|
||||
<div class="control">
|
||||
<input type="text" class="input" name="custom_media_share_host" value="{{ share_api_host() }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">{{ __('app.cronpw') }}</label>
|
||||
</div>
|
||||
|
||||
@@ -1082,7 +1082,7 @@
|
||||
</header>
|
||||
<section class="modal-card-body is-stretched">
|
||||
<div class="field">
|
||||
<p>{{ __('app.share_photo_hint', ['url' => env('APP_SERVICE_URL')]) }}</p>
|
||||
<p>{{ __('app.share_photo_hint', ['url' => share_api_host()]) }}</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
|
||||
Reference in New Issue
Block a user