diff --git a/config/default.json b/config/default.json index cdab2d23..47764010 100644 --- a/config/default.json +++ b/config/default.json @@ -1,6 +1,7 @@ { "WalletConfig": { - "LbryClaimAddress": "none" + "LbryClaimAddress": "none", + "DefaultChannel": "none" }, "AnalyticsConfig":{ "GoogleId": "none" @@ -11,6 +12,8 @@ "Password": "none" }, "Logging": { - "LogLevel": "none" + "LogLevel": "none", + "SlackErrorChannel": "none", + "SlackInfoChannel": "none" } } \ No newline at end of file diff --git a/config/development.json b/config/development.json index 839e5f35..4beca9ff 100644 --- a/config/development.json +++ b/config/development.json @@ -1,13 +1,10 @@ { "WalletConfig": { - "LbryClaimAddress": "none" + "DefaultChannel": "@speechDev" }, "AnalyticsConfig":{ "GoogleId": "UA-100747990-1" }, - "Database": { - "MySqlConnectionUri": "none" - }, "Logging": { "LogLevel": "silly", "SlackErrorChannel": "#staging_speech-errors", diff --git a/config/production.json b/config/production.json index caa0b328..a5bc5074 100644 --- a/config/production.json +++ b/config/production.json @@ -1,13 +1,10 @@ { "WalletConfig": { - "LbryClaimAddress": "none" + "DefaultChannel": "@speech" }, "AnalyticsConfig":{ "GoogleId": "UA-60403362-3" }, - "Database": { - "MySqlConnectionUri": "none" - }, "Logging": { "LogLevel": "verbose", "SlackErrorChannel": "#speech-errors", diff --git a/helpers/lbryApi.js b/helpers/lbryApi.js index e1b2bad2..2b9c1fba 100644 --- a/helpers/lbryApi.js +++ b/helpers/lbryApi.js @@ -122,7 +122,7 @@ module.exports = { }); }); }, - createChannel (name) { + createChannel (name, claimAddress) { return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { diff --git a/helpers/publishHelpers.js b/helpers/publishHelpers.js index 7d801130..44890fce 100644 --- a/helpers/publishHelpers.js +++ b/helpers/publishHelpers.js @@ -32,7 +32,7 @@ module.exports = { throw new Error('The claim name you provided is not allowed. Only the following characters are allowed: A-Z, a-z, 0-9, and "-"'); } // validate license - if ((license.indexOf('Public Domain') === -1) && (license.indexOf('Creative Commons') === -1) && (license.indecOf('CC Attribution-NonCommercial 4.0 International') === -1)) { + if ((license.indexOf('Public Domain') === -1) && (license.indexOf('Creative Commons') === -1)) { throw new Error('Only posts with a "Public Domain" license, or one of the Creative Commons licenses are eligible for publishing through spee.ch'); } switch (nsfw) { @@ -54,6 +54,7 @@ module.exports = { createPublishParams (name, filePath, title, description, license, nsfw, channel) { logger.debug(`Creating Publish Parameters for "${name}"`); const claimAddress = config.get('WalletConfig.LbryClaimAddress'); + const defaultChannel = config.get('WalletConfig.DefaultChannel'); // filter nsfw and ensure it is a boolean if (nsfw === false) { nsfw = false; @@ -72,7 +73,7 @@ module.exports = { if (title === '' || title === null) { title = name; } - if (description === '' || description === null) { + if (description === ' ' || description === null) { description = `${name} published via spee.ch`; } // create the publish params @@ -88,10 +89,15 @@ module.exports = { license, nsfw, }, - channel_name : channel, claim_address: claimAddress, - // change_address: changeAddress, }; + // add channel if applicable + if (channel !== 'none'){ + publishParams['channel_name'] = channel; + } else { + publishParams['channel_name'] = defaultChannel; + } + logger.debug('publishParams:', publishParams); return publishParams; }, diff --git a/migrations/Add-Address-To-User.js b/migrations/Add-Address-To-User.js deleted file mode 100644 index b8f88d6f..00000000 --- a/migrations/Add-Address-To-User.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - up: (queryInterface, Sequelize) => { - // logic for transforming into the new state - return queryInterface.addColumn( - 'User', - 'Address', - { - type : Sequelize.STRING, - allowNull: true, - } - ); - }, - down: (queryInterface, Sequelize) => { - // logic for reverting the changes - return queryInterface.removeColumn( - 'User', - 'Address' - ); - }, -}; diff --git a/migrations/Add-FileId-To-Claim.js b/migrations/Add-FileId-To-Claim2.js similarity index 100% rename from migrations/Add-FileId-To-Claim.js rename to migrations/Add-FileId-To-Claim2.js diff --git a/migrations/Add-UserId-To-Certificate.js b/migrations/Add-UserId-To-Certificate.js index 49217435..9005dee6 100644 --- a/migrations/Add-UserId-To-Certificate.js +++ b/migrations/Add-UserId-To-Certificate.js @@ -1,7 +1,7 @@ module.exports = { up: (queryInterface, Sequelize) => { // logic for transforming into the new state - queryInterface.addColumn( + return queryInterface.addColumn( 'Certificate', 'UserId', { @@ -12,7 +12,7 @@ module.exports = { }, down: (queryInterface, Sequelize) => { // logic for reverting the changes - queryInterface.removeColumn( + return queryInterface.removeColumn( 'Certificate', 'UserId' ); diff --git a/migrations/Remove-UserId-Add-CertificateId.js b/migrations/Remove-UserId-Add-CertificateId.js deleted file mode 100644 index 942ac792..00000000 --- a/migrations/Remove-UserId-Add-CertificateId.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = { - up: (queryInterface, Sequelize) => { - // logic for transforming into the new state - const p1 = queryInterface.addColumn( - 'User', - 'CertificateId', - { - type : Sequelize.STRING, - allowNull: true, - } - ); - const p2 = queryInterface.removeColumn( - 'Certificate', - 'UserId' - ); - return Promise.all([p1, p2]); - }, - down: (queryInterface, Sequelize) => { - // logic for reverting the changes - const p1 = queryInterface.removeColumn( - 'User', - 'CertificateId' - ); - const p2 = queryInterface.addColumn( - 'Certificate', - 'UserId', - { - type : Sequelize.STRING, - allowNull: true, - } - ); - return Promise.all([p1, p2]); - }, -}; diff --git a/migrations/remove-Email-from-User.js b/migrations/remove-Email-from-User.js deleted file mode 100644 index 4d6a39e3..00000000 --- a/migrations/remove-Email-from-User.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - up: (queryInterface, Sequelize) => { - // logic for transforming into the new state - return queryInterface.removeColumn( - 'User', - 'Email' - ); - }, - down: (queryInterface, Sequelize) => { - // logic for reverting the changes - return queryInterface.addColumn( - 'User', - 'Email', - { - type : Sequelize.STRING, - allowNull: true, - } - ); - }, -}; diff --git a/models/user.js b/models/user.js index da7457d8..9368d89d 100644 --- a/models/user.js +++ b/models/user.js @@ -14,10 +14,6 @@ module.exports = (sequelize, { STRING }) => { type : STRING, allowNull: false, }, - address: { - type : STRING, - allowNull: false, - }, }, { freezeTableName: true, diff --git a/passport/local-signup.js b/passport/local-signup.js index 258c554f..f71332af 100644 --- a/passport/local-signup.js +++ b/passport/local-signup.js @@ -19,21 +19,21 @@ module.exports = new PassportLocalStrategy( // server-side validaton of inputs (username, password) // create the channel and retrieve the metadata - return lbryApi.createChannel(username) + return lbryApi.createChannel(username, address) .then(tx => { // create user record const userData = { channelName : username, channelClaimId: tx.claim_id, password : password, - address, + // address, }; logger.debug('userData >', userData); // create certificate record const certificateData = { - address, claimId: tx.claim_id, name : username, + // address, }; logger.debug('certificateData >', certificateData); // save user and certificate to db diff --git a/speech.js b/speech.js index d6df24f0..56d1225a 100644 --- a/speech.js +++ b/speech.js @@ -72,8 +72,9 @@ app.set('view engine', 'handlebars'); app.use((req, res, next) => { if (req.user) { res.locals.user = { - id : req.user.id, - channelName: req.user.channelName, + id : req.user.id, + channelName : req.user.channelName, + channelClaimId: req.user.channelClaimId, }; } next(); diff --git a/views/partials/assetInfo.handlebars b/views/partials/assetInfo.handlebars index b9406f9d..b66fc6f7 100644 --- a/views/partials/assetInfo.handlebars +++ b/views/partials/assetInfo.handlebars @@ -45,8 +45,8 @@ {{/ifConditional}}
{{fileInfo.description}}> +
{{fileInfo.description}}