mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 19:49:59 +05:00
cleaning
This commit is contained in:
parent
0cfc27f3d3
commit
b5377e4c65
@ -20,7 +20,7 @@ define([
|
||||
|
||||
// To inform users of the support ticket panel which languages your admins speak:
|
||||
//AppConfig.supportLanguages = [ 'en', 'fr' ];
|
||||
AppConfig.availablePadTypes = ['drive', 'teams', 'file', 'contacts', 'convert'].concat(ApiConfig.availableApps)
|
||||
AppConfig.availablePadTypes = ['drive', 'teams', 'file', 'contacts', 'convert'].concat(ApiConfig.availableApps);
|
||||
|
||||
return AppConfig;
|
||||
});
|
||||
|
||||
@ -726,8 +726,7 @@ var archivePinLog = function (Env, Server, cb, data) {
|
||||
|
||||
var archiveBlock = function (Env, Server, cb, data) {
|
||||
var args = Array.isArray(data) && data[1];
|
||||
if (!args) {
|
||||
return void cb("INVALID_ARGS"); }
|
||||
if (!args) { return void cb("INVALID_ARGS"); }
|
||||
var key = args.key;
|
||||
var reason = args.reason;
|
||||
if (!isValidKey(key)) { return void cb("EINVAL"); }
|
||||
@ -749,8 +748,7 @@ var archiveBlock = function (Env, Server, cb, data) {
|
||||
|
||||
var restoreArchivedBlock = function (Env, Server, cb, data) {
|
||||
var args = Array.isArray(data) && data[1];
|
||||
if (!args) {
|
||||
return void cb("INVALID_ARGS"); }
|
||||
if (!args) { return void cb("INVALID_ARGS"); }
|
||||
var key = args.key;
|
||||
var reason = args.reason;
|
||||
if (!isValidKey(key)) { return void cb("EINVAL"); }
|
||||
@ -1109,8 +1107,7 @@ Admin.addFirstAdmin = function (Env, data, cb) {
|
||||
if (!Env.installToken) { return void cb('EINVAL'); }
|
||||
var token = data.token;
|
||||
if (!token || !data.edPublic) { return void cb('MISSING_ARGS'); }
|
||||
if (token.length !== 64 || data.edPublic.length !== 44) { console.log('here21')
|
||||
return void cb('INVALID_ARGS'); }
|
||||
if (token.length !== 64 || data.edPublic.length !== 44) { return void cb('INVALID_ARGS'); }
|
||||
if (token !== Env.installToken) { return void cb('FORBIDDEN'); }
|
||||
if (Array.isArray(Env.admins) && Env.admins.length) { return void cb('EEXISTS'); }
|
||||
|
||||
|
||||
@ -167,10 +167,6 @@ var isInteger = function (n) {
|
||||
};
|
||||
|
||||
var args_isString = function (args) {
|
||||
console.log('args', args)
|
||||
console.log(typeof args)
|
||||
console.log(Array.isArray(args))
|
||||
console.log(isString(args[0]))
|
||||
return !(!Array.isArray(args) || !isString(args[0]));
|
||||
};
|
||||
var args_isInteger = function (args) {
|
||||
@ -315,21 +311,19 @@ commands.SET_SUPPORT_KEYS = function (Env, args) {
|
||||
(Core.isValidPublicKey(curvePublic) || !curvePublic) &&
|
||||
typeof(edPublic) === "string" &&
|
||||
(Core.isValidPublicKey(edPublic) || !edPublic);
|
||||
if (!validated) {
|
||||
throw new Error('INVALID_ARGS'); }
|
||||
if (Env.supportMailboxKey === curvePublic && Env.supportPinKey === edPublic) { return false; }
|
||||
Env.supportMailboxKey = curvePublic;
|
||||
Env.supportPinKey = edPublic;
|
||||
return true;
|
||||
};
|
||||
if (!validated) { throw new Error('INVALID_ARGS'); }
|
||||
if (Env.supportMailboxKey === curvePublic && Env.supportPinKey === edPublic) { return false; }
|
||||
Env.supportMailboxKey = curvePublic;
|
||||
Env.supportPinKey = edPublic;
|
||||
return true;
|
||||
};
|
||||
|
||||
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_INSTANCE_PURPOSE', ["development"]]], console.log)
|
||||
commands.SET_INSTANCE_PURPOSE = makeGenericSetter('instancePurpose', args_isString);
|
||||
|
||||
var makeTranslation = function (attr) {
|
||||
return function (Env, args) {
|
||||
if (!Array.isArray(args)) {
|
||||
throw new Error("INVALID_ARGS"); }
|
||||
if (!Array.isArray(args)) { throw new Error("INVALID_ARGS"); }
|
||||
var value = args[0];
|
||||
var state = Env[attr];
|
||||
|
||||
@ -380,7 +374,7 @@ var args_isMaintenance = function (args) {
|
||||
// whenever that happens we can relax validation a bit to support more formats
|
||||
var makeBroadcastSetter = function (attr, validation) {
|
||||
return function (Env, args) {
|
||||
if ((validation && !validation(args)) && !args_isString(args)) {
|
||||
if ((validation && !validation(args)) &&!args_isString(args)) {
|
||||
throw new Error('INVALID_ARGS');
|
||||
}
|
||||
var str = args[0];
|
||||
@ -490,11 +484,8 @@ commands.SET_BEARER_SECRET = function (Env, args) {
|
||||
// [<command>, <args>, <author>, <time>]
|
||||
var handleCommand = Decrees.handleCommand = function (Env, line) {
|
||||
var command = line[0];
|
||||
|
||||
var args = line[1];
|
||||
console.log('command', command)
|
||||
console.log('commands', commands[command])
|
||||
console.log('type', typeof(commands[command]))
|
||||
|
||||
if (typeof(commands[command]) !== 'function') {
|
||||
throw new Error("DECREE_UNSUPPORTED_COMMAND");
|
||||
}
|
||||
|
||||
@ -370,8 +370,7 @@ commands.ADD_MAILBOX = function (meta, args) {
|
||||
};
|
||||
|
||||
commands.RM_MAILBOX = function (meta, args) {
|
||||
if (!Array.isArray(args)) {
|
||||
throw new Error("INVALID_ARGS"); }
|
||||
if (!Array.isArray(args)) { throw new Error("INVALID_ARGS"); }
|
||||
if (!meta.mailbox || typeof(meta.mailbox) === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ var exists = function (path, cb) {
|
||||
|
||||
var checkPath = function (Env, publicKey, pathFunction, _cb) {
|
||||
var cb = Util.once(Util.mkAsync(_cb));
|
||||
if (!isValidKey(publicKey)) { return void cb("INVALID_ARGS"); }
|
||||
if (!isValidKey(publicKey)) { return void cb("INVALID_ARGS"); }
|
||||
var path = pathFunction(Env, publicKey);
|
||||
exists(path, cb);
|
||||
};
|
||||
|
||||
@ -582,8 +582,7 @@ var reportStatus = function (Env, label, safeKey, err, id, size) {
|
||||
};
|
||||
|
||||
const completeUpload = function (data, cb) {
|
||||
if (!data) {
|
||||
return void cb('INVALID_ARGS'); }
|
||||
if (!data) { return void cb('INVALID_ARGS'); }
|
||||
if (typeof(data.safeKey) !== 'string') { return void cb("INVALID_KEY"); }
|
||||
var owned = data.owned;
|
||||
var safeKey = Util.escapeKeyCharacters(data.safeKey);
|
||||
@ -607,8 +606,7 @@ const completeUpload = function (data, cb) {
|
||||
};
|
||||
|
||||
const getPinActivity = function (data, cb) {
|
||||
if (!data) {
|
||||
return void cb("INVALID_ARGS"); }
|
||||
if (!data) { return void cb("INVALID_ARGS"); }
|
||||
if (typeof(data.key) !== 'string') { return void cb("INVALID_KEY"); }
|
||||
var safeKey = Util.escapeKeyCharacters(data.key);
|
||||
var first;
|
||||
@ -635,8 +633,7 @@ const getPinActivity = function (data, cb) {
|
||||
};
|
||||
|
||||
const getLastChannelTime = function (data, cb) {
|
||||
if (!data) {
|
||||
return void cb("INVALID_ARGS"); }
|
||||
if (!data) { return void cb("INVALID_ARGS"); }
|
||||
var latest;
|
||||
store.getMessages(data.channel, function (line) {
|
||||
try {
|
||||
|
||||
@ -205,8 +205,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
||||
};
|
||||
|
||||
commands.RM = function (args, author, roster) {
|
||||
if (!Array.isArray(args)) {
|
||||
throw new Error("INVALID_ARGS"); }
|
||||
if (!Array.isArray(args)) { throw new Error("INVALID_ARGS"); }
|
||||
|
||||
if (typeof(roster.state.members) === 'undefined') {
|
||||
throw new Error("CANNOT_RM_FROM_UNITIALIZED_ROSTER");
|
||||
@ -349,8 +348,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
||||
|
||||
// only admin/owner can change group metadata
|
||||
commands.METADATA = function (args, author, roster) {
|
||||
if (!isMap(args)) { console.log('here27')
|
||||
throw new Error("INVALID_ARGS"); }
|
||||
if (!isMap(args)) { throw new Error("INVALID_ARGS"); }
|
||||
|
||||
if (!canUpdateMetadata(author, roster.state.members)) { throw new Error("INSUFFICIENT_PERMISSIONS"); }
|
||||
|
||||
@ -388,8 +386,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
||||
// that key is ultimately given to the user you'd like on your team
|
||||
// that user can exploit their possession of the public key to remove
|
||||
// the pending invitation with their actual data.
|
||||
if (!isMap(args)) {console.log('here28')
|
||||
throw new Error('INVALID_ARGS'); }
|
||||
if (!isMap(args)) { throw new Error('INVALID_ARGS'); }
|
||||
if (!roster.internal.initialized) { throw new Error("UNINITIALIED"); }
|
||||
if (typeof(roster.state.members) === 'undefined') {
|
||||
throw new Error("CANNOT+INVITE_TO_UNINITIALIED_ROSTER");
|
||||
@ -460,8 +457,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
||||
if (!members[author].pending) { throw new Error("ALREADY_PRESENT"); }
|
||||
|
||||
// args should be a string
|
||||
if (typeof(args) !== 'string') { console.log('here29')
|
||||
throw new Error("INVALID_ARGS"); }
|
||||
if (typeof(args) !== 'string') { throw new Error("INVALID_ARGS"); }
|
||||
// ...and a valid curve key
|
||||
if (!isValidId(args)) { throw new Error("INVALID_CURVE_KEY"); }
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ define([
|
||||
);
|
||||
|
||||
let availableTypes = AppConfig.availablePadTypes.filter(
|
||||
(t) => ooEnabled || !OO_APPS.includes(t)
|
||||
(t) => ooEnabled || !OO_APPS.includes(t),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@ -1,139 +0,0 @@
|
||||
|
||||
|
||||
.configscreen {
|
||||
|
||||
width: 70%;
|
||||
height: 75%;
|
||||
background-color: #212121!important;
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-name {
|
||||
|
||||
width:75%;
|
||||
float:right;
|
||||
padding:10px
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-logo {
|
||||
|
||||
width:20%;
|
||||
height:30%;
|
||||
float:left
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cp-onboardscreen-description {
|
||||
|
||||
width:75%;
|
||||
min-height:10000px;
|
||||
float:right;padding:10px
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-screentitle {
|
||||
|
||||
margin:auto;
|
||||
padding:10px;
|
||||
text-align:center;
|
||||
|
||||
}
|
||||
|
||||
.configscreen {
|
||||
|
||||
width: 70%;
|
||||
height: 75%;
|
||||
background-color: #424242 !important;
|
||||
|
||||
}
|
||||
|
||||
.cp-form-setting-title {
|
||||
|
||||
float:center;
|
||||
padding:10px;
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-maintitle {
|
||||
|
||||
float:center;
|
||||
padding:10px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cp-onboardscreen-form {
|
||||
|
||||
padding:10px;
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-title {
|
||||
|
||||
font-family: "IBM Plex Mono";
|
||||
font-weight: 500;
|
||||
|
||||
}
|
||||
|
||||
.cp-admin-customize-apps-grid {
|
||||
|
||||
width: 80%;
|
||||
color: white;
|
||||
height: 10px !important;
|
||||
margin:auto;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cp-app-drive-element-grid {
|
||||
|
||||
/* .leftside-menu-category_main(); */
|
||||
/* float:left; */
|
||||
/* display: flex; */
|
||||
/* height: 70px !important; */
|
||||
/* align-items: center; */
|
||||
|
||||
/* cursor: pointer;
|
||||
margin: 5px;
|
||||
border-color: white !important;
|
||||
width: 50% !important; */
|
||||
|
||||
display: inline-block !important;
|
||||
height: 60px !important;
|
||||
/* background-color: #212121!important; */
|
||||
|
||||
/* margin: 10px !important; */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.cp-bloop {
|
||||
|
||||
width:60% !important;
|
||||
/* height:400% !important; */
|
||||
float:left !important;
|
||||
|
||||
padding: 5% !important;
|
||||
/* border:1px solid red !important; */
|
||||
background-color: #212121!important;
|
||||
border-color:white;
|
||||
|
||||
}
|
||||
|
||||
.active-app {
|
||||
|
||||
background-color: #212121!important;
|
||||
|
||||
}
|
||||
|
||||
.cp-onboardscreen-checkmark {
|
||||
|
||||
text-align:right !important;
|
||||
color: white !important;
|
||||
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
|
||||
|
||||
|
||||
@ -103,12 +103,10 @@
|
||||
}
|
||||
|
||||
.cp-onboardscreen-save {
|
||||
|
||||
right:0;
|
||||
bottom:0;
|
||||
padding-left:90%;
|
||||
margin-top:5%;
|
||||
|
||||
right:0;
|
||||
bottom:0;
|
||||
padding-left:90%;
|
||||
margin-top:5%;
|
||||
}
|
||||
|
||||
.cp-app-drive-element-grid {
|
||||
|
||||
@ -384,7 +384,6 @@ define([
|
||||
if (offline) { return; }
|
||||
if (color === selectedColor) { return; }
|
||||
selectedColor = color;
|
||||
console.log('clodlo', selectedColor)
|
||||
$colors.find('.cp-kanban-palette').removeClass('fa-check');
|
||||
var $col = $colors.find('.cp-kanban-palette-'+(color || 'nocolor'));
|
||||
$col.addClass('fa-check');
|
||||
|
||||
@ -75,6 +75,7 @@ define([
|
||||
|
||||
// Service worker
|
||||
if ('serviceWorker' in navigator) {
|
||||
console.log('here');
|
||||
var initializing = true;
|
||||
var worker;
|
||||
var postMessage = function (data) {
|
||||
|
||||
@ -37,6 +37,7 @@ onconnect = function(e) {
|
||||
console.log(e);
|
||||
console.log(i);
|
||||
var port = e.ports[0];
|
||||
console.log('here');
|
||||
//require([
|
||||
// '/common/outer/async-store.js'
|
||||
//], function (Store) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user