Skip to content

Commit

Permalink
Merge pull request #2720 from thomasjacquin/Add-"/config/"-alias-to-W…
Browse files Browse the repository at this point in the history
…ebUI

Add "/config/" alias to web UI
  • Loading branch information
EricClaeys authored May 31, 2023
2 parents cb8e356 + 8cf6f89 commit a745d88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions config_repo/lighttpd.conf.repo
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ setenv.add-environment = (

alias.url = ("/current/" => "XX_ALLSKY_HOME_XX/")
alias.url += ("/images/" => "XX_ALLSKY_IMAGES_XX/")
alias.url += ("/config/" => "XX_ALLSKY_CONFIG_XX/")
alias.url += ("/website/" => "XX_ALLSKY_WEBSITE_XX/")
alias.url += ("/documentation" => "XX_ALLSKY_DOCUMENTATION_XX/")
alias.url += ("/overlay" => "XX_ALLSKY_OVERLAY_XX/")
Expand Down
17 changes: 5 additions & 12 deletions html/includes/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
function DisplayEditor()
{
$status = new StatusMessages();
$showFullList = false; // show the full list of what's in ALLSKY_SCRIPTS, or just user-editable files?
$config_dir = basename(ALLSKY_CONFIG);
?>

<script type="text/javascript">

$(document).ready(function () {
var editor = null;
$.get("current/<?php echo $config_dir ?>/config.sh?_ts=" + new Date().getTime(), function (data) {
$.get("config/config.sh?_ts=" + new Date().getTime(), function (data) {
editor = CodeMirror(document.querySelector("#editorContainer"), {
value: data,
mode: "shell",
Expand Down Expand Up @@ -125,20 +123,15 @@ function DisplayEditor()
<div style="margin-top: 15px;">
<?php
$scripts = null;
if(isset($showFullList) && $showFullList == "true") {
$scripts = array_filter(array_diff(scandir(ALLSKY_SCRIPTS), array('.', '..')), function($item) {
// Anything OTHER than a directory is valid.
return !is_dir(ALLSKY_SCRIPTS . "/" . $item);
});
} else if (file_exists(ALLSKY_SCRIPTS . "/endOfNight_additionalSteps.sh")) {
if (file_exists(ALLSKY_SCRIPTS . "/endOfNight_additionalSteps.sh")) {
$scripts[0] = "endOfNight_additionalSteps.sh";
}
?>
<select class="form-control" id="script_path" title="Pick a file"
style="display: inline-block; width: auto; margin-right: 15px; margin-bottom: 5px"
>
<option value="current/<?php echo $config_dir ?>/config.sh">config.sh</option>
<option value="current/<?php echo $config_dir ?>/ftp-settings.sh">ftp-settings.sh</option>
<option value="config/config.sh">config.sh</option>
<option value="config/ftp-settings.sh">ftp-settings.sh</option>

<?php
if ($scripts != null) {
Expand All @@ -156,7 +149,7 @@ function DisplayEditor()
if (file_exists(ALLSKY_WEBSITE_REMOTE_CONFIG)) {
// The website is remote, but a copy of the config file is on the Pi.
$N = ALLSKY_WEBSITE_REMOTE_CONFIG_NAME;
echo "<option value='{REMOTE}current/$config_dir/$N'>$N (remote Allsky Website)</option>";
echo "<option value='{REMOTE}config/$N'>$N (remote Allsky Website)</option>";
}
?>
</select>
Expand Down

0 comments on commit a745d88

Please sign in to comment.