feat: replace exploded base_* with public_url

Fixes #1574

BREAKING CHANGE: The `general` section in the config schema has changed: the `general.base_*`, `general.protocol` and `general.force_ssl` configuration fields have been replaced with a single `general.public_url` field. Be sure to use a valid url with the new configuration field.
This commit is contained in:
jo 2022-04-17 14:38:49 +02:00 committed by Kyle Robbertze
parent d020fbd983
commit 751d430bcc
13 changed files with 297 additions and 144 deletions

View file

@ -3,52 +3,40 @@
<form action="#" role="form" id="generalSettingsForm">
<h3 class="form-title">General Settings</h3>
<p>
These values are automatically pulled from your webserver settings, under most circumstances you will not need to change them.
</p>
<span id="helpBlock" class="help-block help-message"></span>
<div id="generalFormBody">
<div class="form-group">
<label class="control-label" for="generalHost">Webserver Host</label>
<input required class="form-control" type="text" name="generalHost" id="generalHost" placeholder="Host" value="<?php echo $_SERVER['SERVER_NAME']; ?>"/>
<label class="control-label" for="publicUrl">Public URL</label>
<input required class="form-control" type="text" name="publicUrl" id="publicUrl" placeholder="https://example.com/" />
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="generalPort">Webserver Port</label>
<input required class="form-control" type="text" name="generalPort" id="generalPort" placeholder="Port" value="<?php echo $_SERVER['SERVER_PORT']; ?>"/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<input class="form-control" type="hidden" name="generalErr" id="generalErr" aria-describedby="helpBlock"/>
<p>The CORS URL can be setup during install if you are accessing your LibreTime instance behind a Proxy.
<input class="form-control" type="hidden" name="generalErr" id="generalErr" aria-describedby="helpBlock" />
<hr />
<p>
The CORS URL can be setup during install if you are accessing your LibreTime instance behind a Proxy.
This is common with docker setups. If you have a reverse proxy setup enter the URL below, otherwise you
can safely ignore this. Please enter one URL per line. Include the entire URL such as http://example.com
can safely ignore this. Please enter one URL per line. Include the entire URL such as http://example.com
If you are reinstalling LibreTime on an existing setup you can ignore this as well,
the settings in your existing database will be retained unless you enter new values below.
</p>
<div id="corsSlideToggle">
<span><strong>CORS URL </strong></span><span id="corsCaret" class="caret"></span><hr/>
</div>
<div id="corsFormBody">
<div class="form-group">
<label class="control-label" for="corsUrl">CORS URLs</label>
<textarea name="corsUrl" class="form-control" id="corsUrl" rows="4" cols="50"></textarea>
</div>
<label class="control-label" for="corsUrl">CORS URLs</label>
<textarea name="corsUrl" class="form-control" id="corsUrl" rows="4" cols="50"></textarea>
</div>
</div>
<div>
<input type="submit" formtarget="generalSettingsForm" class="btn btn-primary btn-next" value="Next &#10097;"/>
<input type="button" class="btn btn-primary btn-back" value="&#10096; Back"/>
<input type="submit" formtarget="generalSettingsForm" class="btn btn-primary btn-next" value="Next &#10097;" />
<input type="button" class="btn btn-primary btn-back" value="&#10096; Back" />
</div>
</form>
<script>
$("#publicUrl").val(function() {
return window.location.href;
});
$("#corsUrl").text(function() {
return window.location.origin;
});
$("#corsSlideToggle").click(function() {
$("#corsFormBody").slideToggle(500);
$("#corsCaret").toggleClass("caret-up");
});
$("#generalSettingsForm").submit(function(e) {
submitForm(e, "GeneralSetup");
});

View file

@ -1,24 +1,14 @@
# This is an example configuration file.
# See https://libretime.org/docs/setup/configuration
#
# ----------------------------------------------------------------------
# G E N E R A L S E T T I N G S
# ----------------------------------------------------------------------
[general]
# The internal API authentication key, this field is required
# The public url, this field is REQUIRED
public_url =
# The internal API authentication key, this field is REQUIRED
api_key =
# The public url scheme
# Mutually exclusive with force_ssl
protocol = http
# The public url hostname, default is localhost
base_url = localhost
# The public url port
base_port = 80
# The public url base path, default is /
base_dir = /
# Force https for generated urls, default is false
force_ssl = false
# How many hours ahead Playout should cache scheduled media files, default is 1
cache_ahead_hours = 1