1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 10:16:47 +00:00
pixelfed/resources/views/admin/settings/config.blade.php

94 lines
2.8 KiB
PHP
Raw Normal View History

2019-02-11 00:15:57 +00:00
@extends('admin.partial.template')
@include('admin.settings.sidebar')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Configuration Settings</h3>
2019-06-21 02:01:16 +00:00
@if($editor == false)
<hr>
<div class="card bg-light shadow-none rounded-0">
<div class="card-body text-center py-5">
<p class="lead text-muted font-weight-bold">Configuration Editor is disabled</p>
<p class="mb-0">To enable it, add <code>ADMIN_ENV_EDITOR=true</code> to <code>.env</code><br>then run <code>php artisan config:cache</code></p>
</div>
</div>
@else
2019-06-05 00:19:41 +00:00
<p class="lead">Edit configuration settings</p>
2019-06-21 02:01:16 +00:00
<p class="alert alert-warning">
2019-06-21 02:57:33 +00:00
<strong>Warning:</strong> If you have opcache enabled, you may need to restart php for the changes to take effect.
2019-06-21 02:01:16 +00:00
</p>
2019-06-05 00:19:41 +00:00
</div>
<hr>
2019-06-21 02:01:16 +00:00
<div>
<div id="editor">{{$config}}</div>
<hr>
<div class="d-flex justify-content-between px-3">
2019-06-21 02:54:27 +00:00
@if($backup)
2019-06-21 02:01:16 +00:00
<button class="btn btn-outline-secondary font-weight-bold py-1 btn-restore">Restore backup .env</button>
2019-06-21 02:54:27 +00:00
@else
<div></div>
@endif
2019-06-21 02:01:16 +00:00
<button class="btn btn-primary font-weight-bold py-1 btn-save">Save</button>
</div>
</div>
@endif
@endsection
@if($editor == true)
@push('scripts')
2019-06-21 02:16:54 +00:00
<script src="{{mix('js/ace.js')}}"></script>
2019-06-21 02:01:16 +00:00
<script>
let editor = ace.edit("editor");
editor.session.setUseWrapMode(true);
editor.setTheme("ace/theme/monokai");
2019-06-21 02:16:54 +00:00
editor.session.setMode("ace/mode/dot");
2019-06-21 02:01:16 +00:00
$('.btn-restore').on('click', function(e) {
e.preventDefault();
let confirm = window.confirm('Are you sure you want to restore your backup .env?');
if(!confirm) {
swal('Cancelled', 'You have cancelled the .env backup restore.', 'warning');
return;
}
axios.post('/i/admin/settings/config/restore', {
}).then(res => {
2019-06-21 02:22:20 +00:00
swal('Success', 'Configuration successfully restored!', 'success');
setTimeout(function() {
window.location.href = window.location.href;
}, 3000);
2019-06-21 02:01:16 +00:00
});
})
$('.btn-save').on('click', function(e) {
e.preventDefault();
let confirm = window.confirm('Are you sure you want to overwrite your current .env?');
if(!confirm) {
swal('Cancelled', 'You have cancelled the .env update.', 'warning');
return;
}
axios.post('/i/admin/settings/config', {
res: editor.getValue()
}).then(res => {
2019-06-21 02:22:20 +00:00
swal('Success', 'Configuration successfully updated!', 'success');
setTimeout(function() {
window.location.href = window.location.href;
}, 3000);
2019-06-21 02:01:16 +00:00
});
})
</script>
@endpush
@push('styles')
<style type="text/css" media="screen">
#editor {
display: block;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
min-height: 400px;
}
</style>
@endpush
@endif