Skip to content

Commit

Permalink
v3.2.6
Browse files Browse the repository at this point in the history
- fix random name taking over upload names despite being false
- add support to showing archives with diff icon
- `MMFileSaved` & `MMFileUploaded` now has support for mime-type “check rdme”
- config is updated to support extra mime-types for both image & archive
- ratio bar will now follow the same rules as the filter btns ex.“text/pdf, application/archive” are combined
- add new filter “application”
- fixes & cleanup for the broadcasting
- long press on folders will now switch the lock/unlock status of the folder
- fix a couple of console errors
- fix gls not switching the no-data msg correctly
- add new npm dep “vue-input-autowidth”
- add some styling to the gls input to make it easier to click it
  • Loading branch information
ctf0 committed Sep 16, 2018
1 parent 8145ef7 commit 6e48113
Show file tree
Hide file tree
Showing 22 changed files with 453 additions and 318 deletions.
104 changes: 53 additions & 51 deletions README.md

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions logs/v3.2.5.txt

This file was deleted.

12 changes: 12 additions & 0 deletions logs/v3.2.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- fix random name taking over upload names despite being false
- add support to showing archives with diff icon
- `MMFileSaved` & `MMFileUploaded` now has support for mime-type “check rdme”
- config is updated to support extra mime-types for both image & archive
- ratio bar will now follow the same rules as the filter btns ex.“text/pdf, application/archive” are combined
- add new filter “application”
- fixes & cleanup for the broadcasting
- long press on folders will now switch the lock/unlock status of the folder
- fix a couple of console errors
- fix gls not switching the no-data msg correctly
- add new npm dep “vue-input-autowidth”
- add some styling to the gls input to make it easier to click it
19 changes: 15 additions & 4 deletions src/Controllers/Modules/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait Upload
public function upload(Request $request)
{
$upload_path = $request->upload_path;
$random_name = $request->random_names;
$random_name = filter_var($request->random_names, FILTER_VALIDATE_BOOLEAN);
$result = [];
$broadcast = false;

Expand Down Expand Up @@ -56,7 +56,11 @@ public function upload(Request $request)
$saved_name = $this->storeFile($one, $upload_path, $file_name);

// fire event
event('MMFileUploaded', $this->getItemPath($saved_name));
event('MMFileUploaded', [
'file_path' => $this->getItemPath($saved_name),
'mime_type' => $file_type,
'cache_path' => $upload_path,
]);

$broadcast = true;

Expand Down Expand Up @@ -99,6 +103,7 @@ public function upload(Request $request)
public function uploadEditedImage(Request $request)
{
if ($this->allowUpload()) {
$type = $request->mime_type;
$path = $request->path;
$data = explode(',', $request->data)[1];
$original = $request->name;
Expand All @@ -119,7 +124,10 @@ public function uploadEditedImage(Request $request)
$this->storageDisk->put($destination, base64_decode($data));

// fire event
event('MMFileSaved', $this->getItemPath($destination));
event('MMFileSaved', [
'file_path' => $this->getItemPath($destination),
'mime_type' => $type,
]);

// broadcast
broadcast(new MediaFileOpsNotifications([
Expand Down Expand Up @@ -190,7 +198,10 @@ public function uploadLink(Request $request)
$this->storageDisk->put($destination, file_get_contents($url));

// fire event
event('MMFileSaved', $this->getItemPath($destination));
event('MMFileSaved', [
'file_path' => $this->getItemPath($destination),
'mime_type' => $file_type,
]);

// broadcast
broadcast(new MediaFileOpsNotifications([
Expand Down
10 changes: 5 additions & 5 deletions src/Controllers/Modules/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function cleanName($text, $folder = false)
$pattern = $this->filePattern($folder ? $this->folderChars : $this->fileChars);
$text = preg_replace($pattern, '', $text);

return $text == '' ? $this->getRandomString() : $text;
return $text ?: $this->getRandomString();
}

protected function filePattern($item)
Expand All @@ -39,17 +39,17 @@ protected function filePattern($item)
protected function getItemPath($path)
{
$info = $this->storageDiskInfo;
$url = $this->resolveUrl($path);
$url = $this->resolveUrl($path); // get the file url
$root = array_get($info, 'root');

// for other disks without root ex."cloud"
if (!$root) {
return preg_replace('/(.*\/\/.*?)\//', '', $url);
return preg_replace('/(.*\/\/.*?)\//', '', $url); // get the full path
}

$dir = str_replace(array_get($info, 'url'), '', $url);
$dir = str_replace(array_get($info, 'url'), '', $url); // remove the uri

return $root . $dir;
return $root . $dir; // get the full path
}

protected function getItemTime($time)
Expand Down
4 changes: 2 additions & 2 deletions src/MediaRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public static function routes()
$controller = config('mediaManager.controller', '\ctf0\MediaManager\Controllers\MediaController');

app('router')->group([
'prefix' => 'media',
'as' => 'media.',
'prefix' => 'media',
'as' => 'media.',
], function () use ($controller) {
app('router')->get('/', ['uses' => "$controller@index", 'as' => 'index']);
app('router')->post('upload', ['uses' => "$controller@upload", 'as' => 'upload']);
Expand Down
15 changes: 12 additions & 3 deletions src/config/mediaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,19 @@
'unallowed_mimes' => ['php', 'java'],

/*
* other mime-types for images
* extra mime-types
*/
'image_extended_mimes' => [
'binary/octet-stream', // aws
'extended_mimes' => [
// any extra mime-types that doesnt have "image" in it
'image' => [
'binary/octet-stream', // aws
],

// any extra mime-types that doesnt have "compressed" in it
'archive' => [
'application/x-tar',
'application/zip',
],
],

/*
Expand Down
34 changes: 25 additions & 9 deletions src/resources/assets/js/components/globalSearch/panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
<div v-if="showPanel" id="gsearch-panel" class="modal mm-animated fadeIn is-active">
<div class="modal-background"/>
<div class="modal-content">
<div ref="search-input" :class="{'move': moveInput}" class="search-input">
<div ref="search-input" :class="{'move': firstRun}" class="search-input">
<section>
<input ref="search" v-model="search" :placeholder="trans('find')" autofocus>
<div class="input-wrapper">
<input v-autowidth
ref="search"
v-model="search"
:placeholder="trans('find')"
autofocus>
</div>
<transition name="mm-info-in">
<div v-show="listCount" class="count">
<p class="title is-marginless is-2">{{ listCount }}</p>
Expand Down Expand Up @@ -72,6 +78,9 @@ export default {
components: {
imageIntersect: require('./lazyLoading.vue')
},
directives: {
VueInputAutowidth: require('vue-input-autowidth')
},
mixins: [panels],
props: ['trans', 'fileTypeIs', 'noScroll', 'browserSupport'],
data() {
Expand All @@ -80,8 +89,8 @@ export default {
filterdList: [],
search: '',
noData: false,
moveInput: false,
linkCopied: false
linkCopied: false,
firstRun: false
}
},
computed: {
Expand Down Expand Up @@ -131,13 +140,15 @@ export default {
let search = this.search
if (search) {
return this.filterdList = this.fuseLib.search(search)
this.filterdList = this.fuseLib.search(search)
return this.noData = this.listCount ? false : true
}
this.filterdList = []
}, 500),
ontransitionend() {
this.noData = this.search && !this.listCount ? true : false
this.firstRun = true
}
},
watch: {
Expand All @@ -151,16 +162,21 @@ export default {
} else {
this.$nextTick(() => {
this.noData = false
this.moveInput = false
this.firstRun = false
})
}
},
search(val) {
this.moveInput = true
this.getList()
if (!this.firstRun) {
this.$nextTick(() => {
this.firstRun = true
})
}
},
moveInput(val) {
if (val) {
firstRun(val) {
if (!val && this.$refs['search-input']) {
this.$refs['search-input'].addEventListener('transitionend', this.ontransitionend)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,39 +131,36 @@

<!-- presets -->
<presets :image-cropper="imageCropper" :processing="processing"/>
</div>
</div>

<!-- operations -->
<div class="bottom">
<div v-if="imageCropper" class="__bottom-toolbar">
<!-- reset everything -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !hasChanged"
:title="trans('crop_reset')"
class="btn-plain"
@click="Ops('reset')">
<span class="icon"><icon :name="processing ? 'spinner' : 'times'" :pulse="processing"/></span>
</button>
<!-- clear -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !croppedByUser"
:title="trans('clear')"
class="btn-plain"
@click="Ops('clear')">
<span class="icon"><icon :name="processing ? 'spinner' : 'ban'" :pulse="processing"/></span>
</button>
<!-- apply -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !hasChanged"
:title="trans('crop_apply')"
class="btn-plain"
@click="applyChanges()">
<span class="icon"><icon :name="processing ? 'spinner' : 'check'" :pulse="processing"/></span>
</button>
<!-- operations -->
<div v-if="imageCropper" class="__bottom-toolbar">
<!-- reset everything -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !hasChanged"
:title="trans('crop_reset')"
class="btn-plain"
@click="Ops('reset')">
<span class="icon"><icon :name="processing ? 'spinner' : 'times'" :pulse="processing"/></span>
</button>
<!-- clear -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !croppedByUser"
:title="trans('clear')"
class="btn-plain"
@click="Ops('clear')">
<span class="icon"><icon :name="processing ? 'spinner' : 'ban'" :pulse="processing"/></span>
</button>
<!-- apply -->
<button v-tippy="{arrow: true, theme: 'light'}"
:disabled="processing || !hasChanged"
:title="trans('crop_apply')"
class="btn-plain"
@click="applyChanges()">
<span class="icon"><icon :name="processing ? 'spinner' : 'check'" :pulse="processing"/></span>
</button>
</div>
</div>
</div>

</div>
</template>

Expand Down Expand Up @@ -325,7 +322,8 @@ export default {
getData.rotate != 0 ||
getData.scaleX != 1 ||
getData.scaleY != 1 ||
cropper.cropped
cropper.cropped ||
!this.haveFilters()
? true
: false
},
Expand All @@ -342,7 +340,7 @@ export default {
cropper.clear() // selection
cropper.setDragMode(this.dragMode) // active btn
if (this.haveFilters()) this.resetFilters()
if (!this.haveFilters()) this.resetFilters()
this.reset = false
})
},
Expand Down Expand Up @@ -426,17 +424,18 @@ export default {
}).toDataURL(type)
// cropper.replace(data)
this.saveToDisk(data, file.name)
this.saveToDisk(data, file.name, type)
},
saveToDisk(data, name) {
saveToDisk(data, name, type) {
const parent = this.$parent
parent.toggleLoading()
parent.showNotif(parent.trans('stand_by'), 'info')
axios.post(this.route, {
path: parent.files.path,
data: data,
name: name
name: name,
mime_type: type
}).then(({data}) => {
parent.toggleLoading()
Expand Down
2 changes: 1 addition & 1 deletion src/resources/assets/js/components/lazyLoading/normal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
this.src = img
this.$nextTick(() => {
this.$refs.img.style.opacity = 0
if (this.$refs.img) this.$refs.img.style.opacity = 0
this.sendDimensionsToParent()
})
})
Expand Down
6 changes: 3 additions & 3 deletions src/resources/assets/js/components/manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import Watchers from '../modules/watch'
export default {
components: {
cropper: require('./imageEditor/cropper.vue'),
contentRatio: require('./utils/ratio.vue'),
globalSearchBtn: require('./globalSearch/button.vue'),
globalSearchPanel: require('./globalSearch/panel.vue'),
imageCache: require('./lazyLoading/cache.vue'),
imageEditor: require('./imageEditor/main.vue'),
imageIntersect: require('./lazyLoading/normal.vue'),
overlay: require('./utils/overlay.vue'),
usageIntroBtn: require('./usageIntro/button.vue'),
usageIntroPanel: require('./usageIntro/panel.vue'),
overlay: require('./utils/overlay.vue')
usageIntroPanel: require('./usageIntro/panel.vue')
},
name: 'media-manager',
mixins: [
Expand Down
8 changes: 3 additions & 5 deletions src/resources/assets/js/components/utils/ratio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,16 @@ export default {
video: 0,
text: 0,
folder: 0,
application: 0,
pdf: 0
application: 0
}
val.forEach((e) => {
if (this.fileTypeIs(e, 'audio')) ratio.audio++
if (this.fileTypeIs(e, 'video')) ratio.video++
if (this.fileTypeIs(e, 'image')) ratio.image++
if (this.fileTypeIs(e, 'text')) ratio.text++
if (this.fileTypeIs(e, 'pdf')) ratio.pdf++
if (this.fileTypeIs(e, 'folder')) ratio.folder++
if (this.fileTypeIs(e, 'application')) ratio.application++
if (this.fileTypeIs(e, 'text') || this.fileTypeIs(e, 'pdf')) ratio.text++
if (this.fileTypeIs(e, 'application') || this.fileTypeIs(e, 'compressed')) ratio.application++
})
return this.contentRatio = ratio
Expand Down
Loading

0 comments on commit 6e48113

Please sign in to comment.