diff --git a/src/Helpers/ApiResponse.php b/src/Helpers/ApiResponse.php
index e8db1c01d..009fcc40f 100644
--- a/src/Helpers/ApiResponse.php
+++ b/src/Helpers/ApiResponse.php
@@ -4,8 +4,8 @@
use Exception;
use Illuminate\Database\QueryException;
+use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
-use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\ValidationException;
use Uasoft\Badaso\Exceptions\SingleException;
@@ -13,13 +13,11 @@ class ApiResponse
{
private static function send($data, $http_status = 200)
{
- if (is_object($data)) {
- $data->meta = ['media_base_url' => Storage::url('/')];
- } else {
- $data['meta']['media_base_url'] = Storage::url('/');
- }
-
+ $request = new Request;
$response = CaseConvert::camel($data);
+ if ($request->method() === 'GET') {
+ $response = HandleFile::handle($response);
+ }
return response()->json($response, $http_status);
}
diff --git a/src/Helpers/HandleFile.php b/src/Helpers/HandleFile.php
new file mode 100644
index 000000000..40dd75681
--- /dev/null
+++ b/src/Helpers/HandleFile.php
@@ -0,0 +1,67 @@
+ $value) {
+ if (is_array($value)) {
+ $objects[$key] = self::handle($value);
+ } else {
+ $objects[$key] = self::handleUrl($value);
+ }
+ }
+
+ return $objects;
+ }
+
+ protected static function handleUrl($val)
+ {
+ if (stristr($val, 'http://') ?: stristr($val, 'https://')) {
+ return $val;
+ }
+
+ if (preg_match('/^.*\.(jpg|jpeg|gif|svg|ico|tif|tiff|webp|heif|png|bmp)$/i', $val)) {
+ return Storage::url($val);
+ }
+
+ if (Str::contains($val, config('lfm.folder_categories.file.folder_name').'/')) {
+ return str_replace(
+ config('lfm.folder_categories.file.folder_name').'/',
+ Storage::url('/').config('lfm.folder_categories.file.folder_name').'/',
+ $val
+ );
+ }
+
+ return $val;
+ }
+
+ public static function normalize($val)
+ {
+ $objects = [];
+ foreach ($val as $key => $value) {
+ if (is_array($value)) {
+ $objects[$key] = self::normalize($value);
+ } else {
+ $objects[$key] = self::removeBaseUrl($value);
+ }
+ }
+
+ return $objects;
+ }
+
+ protected static function removeBaseUrl($val)
+ {
+ if (Str::contains($val, Storage::url('/'))) {
+ return str_replace(Storage::url('/'), '', $val);
+ }
+
+ return $val;
+ }
+}
diff --git a/src/Images/badaso-images/thumbs/auth-bg.jpg b/src/Images/badaso-images/thumbs/auth-bg.jpg
new file mode 100644
index 000000000..ebf8ddbff
Binary files /dev/null and b/src/Images/badaso-images/thumbs/auth-bg.jpg differ
diff --git a/src/Images/badaso-images/thumbs/badaso.png b/src/Images/badaso-images/thumbs/badaso.png
new file mode 100644
index 000000000..d09d1f527
Binary files /dev/null and b/src/Images/badaso-images/thumbs/badaso.png differ
diff --git a/src/Images/badaso-images/thumbs/default-user.png b/src/Images/badaso-images/thumbs/default-user.png
new file mode 100644
index 000000000..f709e04a8
Binary files /dev/null and b/src/Images/badaso-images/thumbs/default-user.png differ
diff --git a/src/Images/badaso-images/thumbs/favicon.png b/src/Images/badaso-images/thumbs/favicon.png
new file mode 100644
index 000000000..f804a11e9
Binary files /dev/null and b/src/Images/badaso-images/thumbs/favicon.png differ
diff --git a/src/Images/badaso-images/thumbs/logo-144px.png b/src/Images/badaso-images/thumbs/logo-144px.png
new file mode 100644
index 000000000..477abf2ca
Binary files /dev/null and b/src/Images/badaso-images/thumbs/logo-144px.png differ
diff --git a/src/Images/badaso-images/thumbs/logo-192px.png b/src/Images/badaso-images/thumbs/logo-192px.png
new file mode 100644
index 000000000..74d3c72aa
Binary files /dev/null and b/src/Images/badaso-images/thumbs/logo-192px.png differ
diff --git a/src/Images/badaso-images/thumbs/logo-512px.png b/src/Images/badaso-images/thumbs/logo-512px.png
new file mode 100644
index 000000000..f804a11e9
Binary files /dev/null and b/src/Images/badaso-images/thumbs/logo-512px.png differ
diff --git a/src/Images/badaso-images/thumbs/logo.png b/src/Images/badaso-images/thumbs/logo.png
new file mode 100644
index 000000000..f804a11e9
Binary files /dev/null and b/src/Images/badaso-images/thumbs/logo.png differ
diff --git a/src/Images/badaso-images/thumbs/logo.webp b/src/Images/badaso-images/thumbs/logo.webp
new file mode 100644
index 000000000..150b1724c
Binary files /dev/null and b/src/Images/badaso-images/thumbs/logo.webp differ
diff --git a/src/Images/badaso-images/thumbs/maintenance.png b/src/Images/badaso-images/thumbs/maintenance.png
new file mode 100644
index 000000000..ee0a420ba
Binary files /dev/null and b/src/Images/badaso-images/thumbs/maintenance.png differ
diff --git a/src/Middleware/ApiRequest.php b/src/Middleware/ApiRequest.php
index aaedec46b..892279cac 100644
--- a/src/Middleware/ApiRequest.php
+++ b/src/Middleware/ApiRequest.php
@@ -6,6 +6,7 @@
use Illuminate\Contracts\Foundation\Application;
use Uasoft\Badaso\Helpers\ApiResponse;
use Uasoft\Badaso\Helpers\CaseConvert;
+use Uasoft\Badaso\Helpers\HandleFile;
use Uasoft\Badaso\Models\Configuration;
use Uasoft\Badaso\Models\DataType;
@@ -52,6 +53,7 @@ public function handle($request, Closure $next)
app()->setLocale($lang);
$request->merge(CaseConvert::snake($request->all()));
+ $request->merge(HandleFile::normalize($request->all()));
if ($this->isUnderMaintenance() || $this->app->isDownForMaintenance() || $this->isCrudGeneratedMaintenance($request)) {
if ($this->isAdministrator()) {
diff --git a/src/Seeder/Configurations/ConfigurationsSeeder.php b/src/Seeder/Configurations/ConfigurationsSeeder.php
index 71071167c..bc25fd7f6 100644
--- a/src/Seeder/Configurations/ConfigurationsSeeder.php
+++ b/src/Seeder/Configurations/ConfigurationsSeeder.php
@@ -128,6 +128,17 @@ public function run()
'group' => 'adminPanel',
'can_delete' => 0,
],
+ 10 => [
+ 'id' => 11,
+ 'key' => 'maintenanceImage',
+ 'display_name' => 'Image for maintenance page',
+ 'value' => 'files/shares/maintenance.png',
+ 'details' => '{"type":"shares-only"}',
+ 'type' => 'upload_image',
+ 'order' => 10,
+ 'group' => 'adminPanel',
+ 'can_delete' => 0,
+ ],
];
foreach ($settings as $key => $value) {
diff --git a/src/resources/js/assets/scss/module/_upload-file-multiple.scss b/src/resources/js/assets/scss/module/_upload-file-multiple.scss
index bc6e10ea1..ad9258a6b 100644
--- a/src/resources/js/assets/scss/module/_upload-file-multiple.scss
+++ b/src/resources/js/assets/scss/module/_upload-file-multiple.scss
@@ -120,6 +120,12 @@
margin-top: 10px;
overflow: hidden;
position: relative;
+
+ &:hover {
+ & > .badaso-upload-file-multiple__remove-button {
+ opacity: 1;
+ }
+ }
}
&__preview-text {
diff --git a/src/resources/js/assets/scss/module/_upload-file.scss b/src/resources/js/assets/scss/module/_upload-file.scss
index cbd7a59c8..443b610c9 100644
--- a/src/resources/js/assets/scss/module/_upload-file.scss
+++ b/src/resources/js/assets/scss/module/_upload-file.scss
@@ -120,6 +120,12 @@
margin-top: 10px;
overflow: hidden;
position: relative;
+
+ &:hover {
+ & > .badaso-upload-file__remove-button {
+ opacity: 1;
+ }
+ }
}
&__preview-text {
diff --git a/src/resources/js/assets/scss/module/_upload-image-multiple.scss b/src/resources/js/assets/scss/module/_upload-image-multiple.scss
index 8387052f9..09875bbe9 100644
--- a/src/resources/js/assets/scss/module/_upload-image-multiple.scss
+++ b/src/resources/js/assets/scss/module/_upload-image-multiple.scss
@@ -131,6 +131,12 @@
width: auto;
margin: 0 auto;
}
+
+ &:hover {
+ & > .badaso-upload-image-multiple__remove-button {
+ opacity: 1;
+ }
+ }
}
&__preview-image {
diff --git a/src/resources/js/assets/scss/module/_upload-image.scss b/src/resources/js/assets/scss/module/_upload-image.scss
index 4beed7fee..f64da5f33 100644
--- a/src/resources/js/assets/scss/module/_upload-image.scss
+++ b/src/resources/js/assets/scss/module/_upload-image.scss
@@ -14,6 +14,14 @@
}
}
+ &__menu {
+ &--disabled {
+ opacity: 0.25;
+ pointer-events: none;
+ cursor: not-allowed;
+ }
+ }
+
&__popup {
&--bottom-bar {
grid-column: 1/3;
@@ -131,6 +139,12 @@
width: auto;
margin: 0 auto;
}
+
+ &:hover {
+ & > .badaso-upload-image__remove-button {
+ opacity: 1;
+ }
+ }
}
&__preview-image {
diff --git a/src/resources/js/components/BadasoLogoDisplay.vue b/src/resources/js/components/BadasoLogoDisplay.vue
index 799318811..09916872d 100644
--- a/src/resources/js/components/BadasoLogoDisplay.vue
+++ b/src/resources/js/components/BadasoLogoDisplay.vue
@@ -17,12 +17,7 @@ export default {
adminPanelLogo: {
get() {
let config = this.$store.getters["badaso/getConfig"];
- let meta = this.$store.getters["badaso/getMeta"];
- if (config.adminPanelLogo && config.adminPanelLogo != "") {
- return meta.mediaBaseUrl + config.adminPanelLogo;
- } else {
- return null;
- }
+ return config.adminPanelLogo;
},
},
adminPanelHeaderColor: {
diff --git a/src/resources/js/components/BadasoUploadFile.vue b/src/resources/js/components/BadasoUploadFile.vue
index fc2646c83..2e4ce6f99 100644
--- a/src/resources/js/components/BadasoUploadFile.vue
+++ b/src/resources/js/components/BadasoUploadFile.vue
@@ -179,11 +179,13 @@ export default {
showOverlay() {
this.show = true
document.body.style.setProperty('position', 'fixed')
+ document.body.style.setProperty("width", "100%");
this.getFiles()
},
closeOverlay() {
this.show = false
document.body.style.removeProperty('position')
+ document.body.style.removeProperty("width");
},
onFilePicked(e) {
const files = e.target.files;
@@ -234,7 +236,7 @@ export default {
}
},
emitInput() {
- var url = this.files.items[this.activeFile].url.replace(this.$store.state.badaso.meta.mediaBaseUrl, '')
+ let url = this.files.items[this.activeFile].url
this.$emit('input', url)
this.closeOverlay()
},
diff --git a/src/resources/js/components/BadasoUploadFileMultiple.vue b/src/resources/js/components/BadasoUploadFileMultiple.vue
index f24ef97f3..deddf99c6 100644
--- a/src/resources/js/components/BadasoUploadFileMultiple.vue
+++ b/src/resources/js/components/BadasoUploadFileMultiple.vue
@@ -184,11 +184,13 @@ export default {
showOverlay() {
this.show = true
document.body.style.setProperty('position', 'fixed')
+ document.body.style.setProperty("width", "100%");
this.getFiles()
},
closeOverlay() {
this.show = false
document.body.style.removeProperty('position')
+ document.body.style.removeProperty("width");
},
onFilePicked(e) {
let files = e.target.files;
@@ -235,7 +237,7 @@ export default {
emitInput() {
let url = []
this.activeFile.forEach(element => {
- url.push(this.files.items[element].url.replace(this.$store.state.badaso.meta.mediaBaseUrl, ''))
+ url.push(this.files.items[element].url)
});
this.filesName = url.join(', ')
this.$emit('input', url)
diff --git a/src/resources/js/components/BadasoUploadImage.vue b/src/resources/js/components/BadasoUploadImage.vue
index d92df96d4..b05232c2b 100644
--- a/src/resources/js/components/BadasoUploadImage.vue
+++ b/src/resources/js/components/BadasoUploadImage.vue
@@ -5,7 +5,7 @@