mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(files) rm set
This commit is contained in:
parent
d58a3db44c
commit
ca824c07eb
2 changed files with 4 additions and 37 deletions
|
|
@ -74,7 +74,7 @@ var CloudCmd, Util, DOM, io;
|
|||
});
|
||||
|
||||
socket.on('config', function(config) {
|
||||
DOM.Files.set('config', config);
|
||||
DOM.Storage.setAllowed(config.localStorage);
|
||||
});
|
||||
|
||||
socket.on('message', function(data) {
|
||||
|
|
@ -220,7 +220,7 @@ var CloudCmd, Util, DOM, io;
|
|||
setValue(name, data);
|
||||
});
|
||||
|
||||
DOM.Files.set('config', CONFIG);
|
||||
DOM.Storage.setAllowed(obj.localStorage);
|
||||
}
|
||||
|
||||
function saveHttp(obj) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
FILES_HTML = 'file|path|link|pathLink|media',
|
||||
FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload',
|
||||
funcs = [],
|
||||
Data = {},
|
||||
DIR_HTML = '/html/',
|
||||
DIR_HTML_FS = DIR_HTML + 'fs/',
|
||||
DIR_JSON = '/json/';
|
||||
|
|
@ -47,26 +46,6 @@
|
|||
return Files;
|
||||
};
|
||||
|
||||
this.set = function(name, data, callback) {
|
||||
var strFiles = FILES_JSON + '|' + FILES_HTML + '|' + FILES_HTML_ROOT,
|
||||
regExp = new RegExp(strFiles),
|
||||
isFile = regExp.test(name);
|
||||
|
||||
Util.check(arguments, [name, data]);
|
||||
|
||||
if (!isFile) {
|
||||
showError(name);
|
||||
} else {
|
||||
Data[name] = data;
|
||||
Util.exec(callback);
|
||||
}
|
||||
|
||||
if (name === 'config')
|
||||
setConfig(data);
|
||||
|
||||
return Files;
|
||||
};
|
||||
|
||||
function getModule(name, callback) {
|
||||
var path,
|
||||
|
||||
|
|
@ -127,9 +106,6 @@
|
|||
});
|
||||
|
||||
Promises[url].then(function(data) {
|
||||
if (!Data[url])
|
||||
Data[url] = data;
|
||||
|
||||
callback(null, data);
|
||||
}, function(error) {
|
||||
Promises[url] = null;
|
||||
|
|
@ -146,19 +122,10 @@
|
|||
});
|
||||
|
||||
Promises.config.then(function(data) {
|
||||
if (!Data.config) {
|
||||
Data.config = data;
|
||||
setConfig(data);
|
||||
}
|
||||
Storage.setAllowed(data.localStorage);
|
||||
|
||||
callback(null, Data.config);
|
||||
callback(null, data);
|
||||
});
|
||||
}
|
||||
|
||||
function setConfig(config) {
|
||||
var isStorage = config.localStorage;
|
||||
|
||||
Storage.setAllowed(isStorage);
|
||||
}
|
||||
}
|
||||
})(Util, DOM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue