switched session key to env var, added thumbnail to Claim upsert on publish
This commit is contained in:
parent
426b605acb
commit
0c11eb4b55
4 changed files with 14 additions and 8 deletions
|
@ -8,5 +8,8 @@
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"SlackWebHook": "SLACK_WEB_HOOK"
|
"SlackWebHook": "SLACK_WEB_HOOK"
|
||||||
|
},
|
||||||
|
"Session": {
|
||||||
|
"SessionKey": "SESSION_KEY"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,5 +16,8 @@
|
||||||
"SlackWebHook": null,
|
"SlackWebHook": null,
|
||||||
"SlackErrorChannel": null,
|
"SlackErrorChannel": null,
|
||||||
"SlackInfoChannel": null
|
"SlackInfoChannel": null
|
||||||
|
},
|
||||||
|
"Session": {
|
||||||
|
"SessionKey": null
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,16 +13,16 @@ module.exports = {
|
||||||
.then(tx => {
|
.then(tx => {
|
||||||
logger.info(`Successfully published ${fileName}`, tx);
|
logger.info(`Successfully published ${fileName}`, tx);
|
||||||
publishResults = tx;
|
publishResults = tx;
|
||||||
return db.Channel.findOne({where: {channelName: publishParams.channel_name}});
|
return db.Channel.findOne({where: {channelName: publishParams.channel_name}}); // note: should this be db.User ??
|
||||||
})
|
})
|
||||||
.then(user => {
|
.then(channel => {
|
||||||
let certificateId;
|
let certificateId;
|
||||||
if (user) {
|
if (channel) {
|
||||||
certificateId = user.channelClaimId;
|
certificateId = channel.channelClaimId;
|
||||||
logger.debug('successfully found user in User table');
|
logger.debug('successfully found channel in Channel table');
|
||||||
} else {
|
} else {
|
||||||
certificateId = null;
|
certificateId = null;
|
||||||
logger.debug('user for publish not found in User table');
|
logger.debug('channel for publish not found in Channel table');
|
||||||
};
|
};
|
||||||
const fileRecord = {
|
const fileRecord = {
|
||||||
name : publishParams.name,
|
name : publishParams.name,
|
||||||
|
@ -43,6 +43,7 @@ module.exports = {
|
||||||
title : publishParams.metadata.title,
|
title : publishParams.metadata.title,
|
||||||
description: publishParams.metadata.description,
|
description: publishParams.metadata.description,
|
||||||
address : publishParams.claim_address,
|
address : publishParams.claim_address,
|
||||||
|
thumbnail : publishParams.metadata.thumbnail,
|
||||||
outpoint : `${publishResults.txid}:${publishResults.nout}`,
|
outpoint : `${publishResults.txid}:${publishResults.nout}`,
|
||||||
height : 0,
|
height : 0,
|
||||||
contentType: fileType,
|
contentType: fileType,
|
||||||
|
|
|
@ -14,7 +14,6 @@ const PORT = 3000; // set port
|
||||||
const app = express(); // create an Express application
|
const app = express(); // create an Express application
|
||||||
const db = require('./models'); // require our models for syncing
|
const db = require('./models'); // require our models for syncing
|
||||||
const passport = require('passport');
|
const passport = require('passport');
|
||||||
// const session = require('express-session');
|
|
||||||
const cookieSession = require('cookie-session');
|
const cookieSession = require('cookie-session');
|
||||||
|
|
||||||
// configure logging
|
// configure logging
|
||||||
|
@ -43,7 +42,7 @@ app.use((req, res, next) => { // custom logging middleware to log all incoming
|
||||||
// initialize passport
|
// initialize passport
|
||||||
app.use(cookieSession({
|
app.use(cookieSession({
|
||||||
name : 'session',
|
name : 'session',
|
||||||
keys : ['testcatstest'],
|
keys : [config.get('Session.SessionKey')],
|
||||||
maxAge: 24 * 60 * 60 * 1000, // 24 hours
|
maxAge: 24 * 60 * 60 * 1000, // 24 hours
|
||||||
}));
|
}));
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
|
|
Loading…
Add table
Reference in a new issue