Authentication #170
|
@ -1,6 +1,7 @@
|
|||
👍 :+1:
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
{
|
||||
"WalletConfig": {
|
||||
"LbryClaimAddress": "none"
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"LbryClaimAddress": "none",
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"DefaultChannel": "none"
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
},
|
||||
"AnalyticsConfig":{
|
||||
"GoogleId": "none"
|
||||
|
@ -11,6 +12,8 @@
|
|||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"Password": "none"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": "none"
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"LogLevel": "none",
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"SlackErrorChannel": "none",
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
"SlackInfoChannel": "none"
|
||||
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked. Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.
👍 :+1:
|
||||
}
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
{
|
||||
"WalletConfig": {
|
||||
"LbryClaimAddress": "none"
|
||||
"DefaultChannel": "@speechDev"
|
||||
},
|
||||
"AnalyticsConfig":{
|
||||
"GoogleId": "UA-100747990-1"
|
||||
},
|
||||
"Database": {
|
||||
"MySqlConnectionUri": "none"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": "silly",
|
||||
"SlackErrorChannel": "#staging_speech-errors",
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
{
|
||||
"WalletConfig": {
|
||||
"LbryClaimAddress": "none"
|
||||
"DefaultChannel": "@speech"
|
||||
},
|
||||
"AnalyticsConfig":{
|
||||
"GoogleId": "UA-60403362-3"
|
||||
},
|
||||
"Database": {
|
||||
"MySqlConnectionUri": "none"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": "verbose",
|
||||
"SlackErrorChannel": "#speech-errors",
|
||||
|
|
|
@ -122,7 +122,7 @@ module.exports = {
|
|||
});
|
||||
});
|
||||
},
|
||||
createChannel (name) {
|
||||
createChannel (name, claimAddress) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
.post('http://localhost:5279/lbryapi', {
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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'
|
||||
);
|
||||
},
|
||||
};
|
|
@ -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'
|
||||
);
|
||||
|
|
|
@ -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]);
|
||||
},
|
||||
};
|
|
@ -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,
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
|
@ -14,10 +14,6 @@ module.exports = (sequelize, { STRING }) => {
|
|||
type : STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
address: {
|
||||
type : STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
freezeTableName: true,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -73,7 +73,8 @@ app.use((req, res, next) => {
|
|||
if (req.user) {
|
||||
res.locals.user = {
|
||||
id : req.user.id,
|
||||
channelName: req.user.channelName,
|
||||
channelName : req.user.channelName,
|
||||
channelClaimId: req.user.channelClaimId,
|
||||
};
|
||||
}
|
||||
next();
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
<div class="panel">
|
||||
<h2>Description</h2>
|
||||
<p>{{fileInfo.description}}</>
|
||||
<p>{{fileInfo.description}}</p>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<h2 class="subheader">Metadata</h2>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{{#if user}}
|
||||
<option value="{{user.channelName}}" >{{user.channelName}}</option>
|
||||
{{/if}}
|
||||
<option value="@speech" >Anonymous</option>
|
||||
<option value="none" >None</option>
|
||||
<option value="login">Login</option>
|
||||
<option value="new" >New</option>
|
||||
</select>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<a href="/about" class="top-bar-right">help</a>
|
||||
|
||||
{{#if user}}
|
||||
<a href="/{{user.channelName}}" class="top-bar-right">{{user.channelName}}</a>
|
||||
<a href="/{{user.channelName}}:{{user.channelClaimId}}" class="top-bar-right">{{user.channelName}}</a>
|
||||
<a href="/logout" class="top-bar-right">logout</a>
|
||||
{{else}}
|
||||
<a href="/login" class="top-bar-right">login</a>
|
||||
|
|
Great design here! Love that this makes it easy to use different channels on staging/dev and production as well as easy to change if forked.