Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1d51001

Browse files
committed
Fixing file manager by adding localstorage and configuring at init.js
1 parent0b5c59c commit1d51001

File tree

6 files changed

+30
-16
lines changed

6 files changed

+30
-16
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"laravel-frontend-file-manager",
3-
"version":"3.0.17",
3+
"version":"3.0.34",
44
"description":"File manager for Laravel",
55
"keywords": [
66
"laravel",

‎src/FileManager.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ export default {
8787
created() {
8888
// manual settings
8989
this.$store.commit('fm/settings/manualSettings',this.settings);
90-
/**
91-
* FIXME: Manual settings set the vuex settings store but to initiate axios, that value is not available
92-
* in js files, I am using localstorage to manage those settings.
93-
*/
94-
localstore.setStorage(localstore.axiosSettingType,this.settings);
95-
9690
// initiate Axios
9791
this.$store.commit('fm/settings/initAxiosSettings');
9892
this.setAxiosConfig();
@@ -122,12 +116,18 @@ export default {
122116
}),
123117
},
124118
methods: {
119+
storeAxiosConfig() {
120+
localstore.setStorage(localstore.axiosSettingType,this.settings);
121+
},
125122
/**
126123
* Axios default config
127124
*/
128125
setAxiosConfig() {
129-
// HTTP.defaults.baseURL = this.$store.getters['fm/settings/baseUrl'];
130-
// HTTP.defaults.headers = this.$store.getters['fm/settings/headers'];
126+
/** Original version **/
127+
/*HTTP.defaults.baseURL = this.$store.getters['fm/settings/baseUrl'];
128+
HTTP.defaults.headers = this.$store.getters['fm/settings/headers'];*/
129+
130+
/** Customized by Mohammad Ashrafuddin Ferdousi*/
131131
let settings=localstore.getStorage(localstore.axiosSettingType);
132132
133133
if(settings) {

‎src/components/manager/GridView.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
v-on:dblclick="selectAction(file.path, file.extension)"
3535
v-on:contextmenu.prevent="contextMenu(file, $event)"
3636
>
37-
{{ files }}
3837
<divclass="fm-item-icon">
3938
<iv-if="acl && file.acl === 0"class="bi bi-file-earmark-lock pb-2" />
4039
<thumbnailv-else-if="thisImage(file.extension)"v-bind:disk="disk"v-bind:file="file"></thumbnail>

‎src/components/manager/Thumbnail.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ export default {
7070
// if authorization required
7171
if (this.auth) {
7272
GET.thumbnail(this.disk,this.file.path).then((response)=> {
73-
constmimeType=response.headers['content-type'].toLowerCase();
73+
// FIXED: Mohammad Ashrafuddin Ferdousi
74+
constmimeType=response.data.headers['Content-Type'].toLowerCase();
7475
//const imgBase64 = Buffer.from(response.data, 'binary').toString('base64');
75-
76-
this.src=`data:${mimeType};base64,${response.data}`;
76+
this.src=`data:${mimeType};base64,${response.data.data}`;
7777
});
7878
}else {
7979
this.src=`${this.$store.getters['fm/settings/baseUrl']}thumbnails?disk=${

‎src/components/modals/views/PreviewModal.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ export default {
131131
// if authorization required
132132
if (this.auth) {
133133
GET.preview(this.selectedDisk,this.selectedItem.path).then((response)=> {
134-
constmimeType=response.headers['content-type'].toLowerCase();
135-
constimgBase64=Buffer.from(response.data,'binary').toString('base64');
134+
// FIXED: Mohammad Ashrafuddin Ferdousi
135+
constmimeType=response.data.headers['Content-Type'].toLowerCase();
136+
// const imgBase64 = Buffer.from(response.data, 'binary').toString('base64');
136137
137-
this.imgSrc=`data:${mimeType};base64,${imgBase64}`;
138+
this.imgSrc=`data:${mimeType};base64,${response.data.data}`;
138139
});
139140
}else {
140141
this.imgSrc=`${this.$store.getters['fm/settings/baseUrl']}preview?disk=${

‎src/init.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
importstorefrom'./store';
22
importFileManagerfrom'./FileManager.vue';
3+
importlocalstorefrom'./mixins/localstore';
4+
importHTTPfrom'./http/axios';
35

46
exportdefault{
57
install:(app,options)=>{
@@ -9,5 +11,17 @@ export default {
911
app.component('file-manager',FileManager);
1012

1113
options.store.registerModule('fm',store);
14+
15+
localstore.setStorage(localstore.axiosSettingType,options.settings);
16+
17+
letsettings=options.settings;
18+
19+
if(settings){
20+
if(settings.baseURL)HTTP.defaults.baseURL=settings.baseURL;
21+
if(settings.withCredentials)HTTP.defaults.withCredentials=settings.withCredentials;
22+
if(settings.headers)HTTP.defaults.headers=settings.headers;
23+
}else{
24+
throw`settings.baseURL:${settings.baseURL}, settings.withCredentials:${settings.withCredentials}, settings.headers:${settings.headers} is set!`;
25+
}
1226
},
1327
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp