fix some artifact serialization trouble; fix login error
This commit is contained in:
parent
f396bc2e40
commit
c5783feca9
@ -37,7 +37,7 @@ const convertableAudioTypes = [
|
|||||||
"application/ogg",
|
"application/ogg",
|
||||||
"audio/amr",
|
"audio/amr",
|
||||||
"audio/3ga",
|
"audio/3ga",
|
||||||
"audio/wav",
|
"audio/wave",
|
||||||
"audio/3gpp",
|
"audio/3gpp",
|
||||||
"audio/x-wav",
|
"audio/x-wav",
|
||||||
"audio/aiff",
|
"audio/aiff",
|
||||||
@ -263,6 +263,8 @@ var resizeAndUploadImage = function(a, mimeType, size, fileName, fileNameOrg, im
|
|||||||
a.h = Math.round(size.height*factor);
|
a.h = Math.round(size.height*factor);
|
||||||
|
|
||||||
a.updated_at = new Date();
|
a.updated_at = new Date();
|
||||||
|
db.packArtifact(a);
|
||||||
|
|
||||||
a.save().then(function() {
|
a.save().then(function() {
|
||||||
fs.unlink(originalFilePath, function (err) {
|
fs.unlink(originalFilePath, function (err) {
|
||||||
if (err){
|
if (err){
|
||||||
@ -328,6 +330,8 @@ module.exports = {
|
|||||||
a.h = Math.round(size.height*factor);
|
a.h = Math.round(size.height*factor);
|
||||||
|
|
||||||
a.updated_at = new Date();
|
a.updated_at = new Date();
|
||||||
|
db.packArtifact(a);
|
||||||
|
|
||||||
a.save().then(function() {
|
a.save().then(function() {
|
||||||
fs.unlink(localFilePath, function (err) {
|
fs.unlink(localFilePath, function (err) {
|
||||||
if (err){
|
if (err){
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"specify": "Bitte spezifiziere",
|
"specify": "Bitte spezifiziere",
|
||||||
"confirm": "Bitte bestätige",
|
"confirm": "Bitte bestätige",
|
||||||
"signup_google": "Mit Google anmelden",
|
"signup_google": "Mit Google anmelden",
|
||||||
"error_unknown_email": "Unbekannte Kombination von Email und Passwort. Oder versuche dich mit Google anzumelden.",
|
"error_unknown_email": "Unbekannte Kombination von Email und Passwort.",
|
||||||
"error_password_confirmation": "Die beiden Passwörter stimmen nicht überein.",
|
"error_password_confirmation": "Die beiden Passwörter stimmen nicht überein.",
|
||||||
"error_domain_blocked": "Diese Domain ist gesperrt.",
|
"error_domain_blocked": "Diese Domain ist gesperrt.",
|
||||||
"error_user_email_already_used": "Diese Email-Adresse ist bereits registriert.",
|
"error_user_email_already_used": "Diese Email-Adresse ist bereits registriert.",
|
||||||
|
@ -44,8 +44,7 @@
|
|||||||
"sure": "Are you sure?",
|
"sure": "Are you sure?",
|
||||||
"specify": "Please Specify",
|
"specify": "Please Specify",
|
||||||
"confirm": "Please Confirm",
|
"confirm": "Please Confirm",
|
||||||
"signup_google": "Sign In with Google",
|
"error_unknown_email": "This email/password combination is unknown.",
|
||||||
"error_unknown_email": "This email/password combination is unknown. Try login with Google.",
|
|
||||||
"error_password_confirmation": "The entered passwords don't match.",
|
"error_password_confirmation": "The entered passwords don't match.",
|
||||||
"error_domain_blocked": "Your domain is blocked.",
|
"error_domain_blocked": "Your domain is blocked.",
|
||||||
"error_user_email_already_used": "This email address is already in use.",
|
"error_user_email_already_used": "This email address is already in use.",
|
||||||
@ -322,4 +321,4 @@
|
|||||||
"mute_present": "Unfollow",
|
"mute_present": "Unfollow",
|
||||||
"follow_present_help": "If someone else is presenting this Space, the other members automatically follow the presentation. Switch following on or off with this button.",
|
"follow_present_help": "If someone else is presenting this Space, the other members automatically follow the presentation. Switch following on or off with this button.",
|
||||||
"export": "export"
|
"export": "export"
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"specify": "Veuillez préciser:",
|
"specify": "Veuillez préciser:",
|
||||||
"confirm": "Veuillez confirmer",
|
"confirm": "Veuillez confirmer",
|
||||||
"signup_google": "S'inscrire avec Google",
|
"signup_google": "S'inscrire avec Google",
|
||||||
"error_unknown_email": "Combinaison inconnue de l'email et mot de passe. Ou essayer de signer avec Google.",
|
"error_unknown_email": "Combinaison inconnue de l'email et mot de passe.",
|
||||||
"error_password_confirmation": "Les deux mots de passe ne correspondent pas.",
|
"error_password_confirmation": "Les deux mots de passe ne correspondent pas.",
|
||||||
"error_domain_blocked": "Ce domaine a été désactivé.",
|
"error_domain_blocked": "Ce domaine a été désactivé.",
|
||||||
"error_user_email_already_used": "Cette adresse email est déjà enregistré.",
|
"error_user_email_already_used": "Cette adresse email est déjà enregistré.",
|
||||||
@ -315,4 +315,4 @@
|
|||||||
"follow_present": "Suivre",
|
"follow_present": "Suivre",
|
||||||
"mute_present": "Pas suivre",
|
"mute_present": "Pas suivre",
|
||||||
"follow_present_help": "follow_present_help"
|
"follow_present_help": "follow_present_help"
|
||||||
}
|
}
|
||||||
|
12
models/db.js
12
models/db.js
@ -320,26 +320,26 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
unpackArtifact: (a) => {
|
unpackArtifact: (a) => {
|
||||||
if (a.tags) {
|
if (a.tags && (typeof a.tags)=="string") {
|
||||||
a.tags = JSON.parse(a.tags);
|
a.tags = JSON.parse(a.tags);
|
||||||
}
|
}
|
||||||
if (a.control_points) {
|
if (a.control_points && (typeof a.control_points)=="string") {
|
||||||
a.control_points = JSON.parse(a.control_points);
|
a.control_points = JSON.parse(a.control_points);
|
||||||
}
|
}
|
||||||
if (a.payload_alternatives) {
|
if (a.payload_alternatives && (typeof a.payload_alternatives)=="string") {
|
||||||
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
packArtifact: (a) => {
|
packArtifact: (a) => {
|
||||||
if (a.tags) {
|
if (a.tags && (typeof a.tags)!="string") {
|
||||||
a.tags = JSON.stringify(a.tags);
|
a.tags = JSON.stringify(a.tags);
|
||||||
}
|
}
|
||||||
if (a.control_points) {
|
if (a.control_points && (typeof a.control_points)!="string") {
|
||||||
a.control_points = JSON.stringify(a.control_points);
|
a.control_points = JSON.stringify(a.control_points);
|
||||||
}
|
}
|
||||||
if (a.payload_alternatives) {
|
if (a.payload_alternatives && (typeof a.payload_alternatives)!="string") {
|
||||||
a.payload_alternatives = JSON.stringify(a.payload_alternatives);
|
a.payload_alternatives = JSON.stringify(a.payload_alternatives);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
|
@ -41,7 +41,7 @@ var SpacedeckBoardArtifacts = {
|
|||||||
if ("medium_for_object" in this) {
|
if ("medium_for_object" in this) {
|
||||||
var medium = this.medium_for_object[a._id];
|
var medium = this.medium_for_object[a._id];
|
||||||
if (medium && a._id != this.editing_artifact_id) {
|
if (medium && a._id != this.editing_artifact_id) {
|
||||||
medium.value(a.description);
|
medium.value(a.description.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -88,10 +88,11 @@ var SpacedeckBoardArtifacts = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
artifact_is_text_blank: function(a) {
|
artifact_is_text_blank: function(a) {
|
||||||
if(a.description){
|
if (a.description) {
|
||||||
var filtered = a.description.replace(/<[^>]+>/g,"").replace(/\s/g,"");
|
desc = a.description.toString();
|
||||||
|
var filtered = desc.replace(/<[^>]+>/g,"").replace(/\s/g,"");
|
||||||
return (filtered.length<1);
|
return (filtered.length<1);
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -26,9 +26,10 @@ router.post('/', function(req, res) {
|
|||||||
//res.status(400).json({"error":"session.users"});
|
//res.status(400).json({"error":"session.users"});
|
||||||
})
|
})
|
||||||
.then(user => {
|
.then(user => {
|
||||||
console.log("!!! user: ",user.password_hash);
|
if (!user) {
|
||||||
|
res.sendStatus(404);
|
||||||
if (bcrypt.compareSync(password, user.password_hash)) {
|
}
|
||||||
|
else if (bcrypt.compareSync(password, user.password_hash)) {
|
||||||
crypto.randomBytes(48, function(ex, buf) {
|
crypto.randomBytes(48, function(ex, buf) {
|
||||||
var token = buf.toString('hex');
|
var token = buf.toString('hex');
|
||||||
console.log("!!! token: ",token);
|
console.log("!!! token: ",token);
|
||||||
|
@ -53,15 +53,8 @@ router.get('/', (req, res) => {
|
|||||||
space_id: req.space._id
|
space_id: req.space._id
|
||||||
}}).then(artifacts => {
|
}}).then(artifacts => {
|
||||||
async.map(artifacts, (a, cb) => {
|
async.map(artifacts, (a, cb) => {
|
||||||
//a = a.toObject(); TODO
|
db.unpackArtifact(a);
|
||||||
|
|
||||||
if (a.control_points) {
|
|
||||||
a.control_points = JSON.parse(a.control_points);
|
|
||||||
}
|
|
||||||
if (a.payload_alternatives) {
|
|
||||||
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a.user_id) {
|
if (a.user_id) {
|
||||||
// FIXME JOIN
|
// FIXME JOIN
|
||||||
/*User.findOne({where: {
|
/*User.findOne({where: {
|
||||||
@ -131,7 +124,8 @@ router.post('/:artifact_id/payload', function(req, res, next) {
|
|||||||
var stream = req.pipe(writeStream);
|
var stream = req.pipe(writeStream);
|
||||||
|
|
||||||
var progress_callback = function(progress_msg) {
|
var progress_callback = function(progress_msg) {
|
||||||
a.description = progress_msg;
|
a.description = progress_msg.toString();
|
||||||
|
db.packArtifact(a);
|
||||||
a.save();
|
a.save();
|
||||||
redis.sendMessage("update", a, a.toJSON(), req.channelId);
|
redis.sendMessage("update", a, a.toJSON(), req.channelId);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user