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": {
|
"WalletConfig": {
|
||||||
"LbryClaimAddress": "none"
|
"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:
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":{
|
"AnalyticsConfig":{
|
||||||
"GoogleId": "none"
|
"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"
|
"Password": "none"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": "none"
|
"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:
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": {
|
"WalletConfig": {
|
||||||
"LbryClaimAddress": "none"
|
"DefaultChannel": "@speechDev"
|
||||||
},
|
},
|
||||||
"AnalyticsConfig":{
|
"AnalyticsConfig":{
|
||||||
"GoogleId": "UA-100747990-1"
|
"GoogleId": "UA-100747990-1"
|
||||||
},
|
},
|
||||||
"Database": {
|
|
||||||
"MySqlConnectionUri": "none"
|
|
||||||
},
|
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": "silly",
|
"LogLevel": "silly",
|
||||||
"SlackErrorChannel": "#staging_speech-errors",
|
"SlackErrorChannel": "#staging_speech-errors",
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
{
|
{
|
||||||
"WalletConfig": {
|
"WalletConfig": {
|
||||||
"LbryClaimAddress": "none"
|
"DefaultChannel": "@speech"
|
||||||
},
|
},
|
||||||
"AnalyticsConfig":{
|
"AnalyticsConfig":{
|
||||||
"GoogleId": "UA-60403362-3"
|
"GoogleId": "UA-60403362-3"
|
||||||
},
|
},
|
||||||
"Database": {
|
|
||||||
"MySqlConnectionUri": "none"
|
|
||||||
},
|
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": "verbose",
|
"LogLevel": "verbose",
|
||||||
"SlackErrorChannel": "#speech-errors",
|
"SlackErrorChannel": "#speech-errors",
|
||||||
|
|
|
@ -122,7 +122,7 @@ module.exports = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
createChannel (name) {
|
createChannel (name, claimAddress) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.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 "-"');
|
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
|
// 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');
|
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) {
|
switch (nsfw) {
|
||||||
|
@ -54,6 +54,7 @@ module.exports = {
|
||||||
createPublishParams (name, filePath, title, description, license, nsfw, channel) {
|
createPublishParams (name, filePath, title, description, license, nsfw, channel) {
|
||||||
logger.debug(`Creating Publish Parameters for "${name}"`);
|
logger.debug(`Creating Publish Parameters for "${name}"`);
|
||||||
const claimAddress = config.get('WalletConfig.LbryClaimAddress');
|
const claimAddress = config.get('WalletConfig.LbryClaimAddress');
|
||||||
|
const defaultChannel = config.get('WalletConfig.DefaultChannel');
|
||||||
// filter nsfw and ensure it is a boolean
|
// filter nsfw and ensure it is a boolean
|
||||||
if (nsfw === false) {
|
if (nsfw === false) {
|
||||||
nsfw = false;
|
nsfw = false;
|
||||||
|
@ -72,7 +73,7 @@ module.exports = {
|
||||||
if (title === '' || title === null) {
|
if (title === '' || title === null) {
|
||||||
title = name;
|
title = name;
|
||||||
}
|
}
|
||||||
if (description === '' || description === null) {
|
if (description === ' ' || description === null) {
|
||||||
description = `${name} published via spee.ch`;
|
description = `${name} published via spee.ch`;
|
||||||
}
|
}
|
||||||
// create the publish params
|
// create the publish params
|
||||||
|
@ -88,10 +89,15 @@ module.exports = {
|
||||||
license,
|
license,
|
||||||
nsfw,
|
nsfw,
|
||||||
},
|
},
|
||||||
channel_name : channel,
|
|
||||||
claim_address: claimAddress,
|
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);
|
logger.debug('publishParams:', publishParams);
|
||||||
return 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 = {
|
module.exports = {
|
||||||
up: (queryInterface, Sequelize) => {
|
up: (queryInterface, Sequelize) => {
|
||||||
// logic for transforming into the new state
|
// logic for transforming into the new state
|
||||||
queryInterface.addColumn(
|
return queryInterface.addColumn(
|
||||||
'Certificate',
|
'Certificate',
|
||||||
'UserId',
|
'UserId',
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
down: (queryInterface, Sequelize) => {
|
down: (queryInterface, Sequelize) => {
|
||||||
// logic for reverting the changes
|
// logic for reverting the changes
|
||||||
queryInterface.removeColumn(
|
return queryInterface.removeColumn(
|
||||||
'Certificate',
|
'Certificate',
|
||||||
'UserId'
|
'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,
|
type : STRING,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
},
|
},
|
||||||
address: {
|
|
||||||
type : STRING,
|
|
||||||
allowNull: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
freezeTableName: true,
|
freezeTableName: true,
|
||||||
|
|
|
@ -19,21 +19,21 @@ module.exports = new PassportLocalStrategy(
|
||||||
// server-side validaton of inputs (username, password)
|
// server-side validaton of inputs (username, password)
|
||||||
|
|
||||||
// create the channel and retrieve the metadata
|
// create the channel and retrieve the metadata
|
||||||
return lbryApi.createChannel(username)
|
return lbryApi.createChannel(username, address)
|
||||||
.then(tx => {
|
.then(tx => {
|
||||||
// create user record
|
// create user record
|
||||||
const userData = {
|
const userData = {
|
||||||
channelName : username,
|
channelName : username,
|
||||||
channelClaimId: tx.claim_id,
|
channelClaimId: tx.claim_id,
|
||||||
password : password,
|
password : password,
|
||||||
address,
|
// address,
|
||||||
};
|
};
|
||||||
logger.debug('userData >', userData);
|
logger.debug('userData >', userData);
|
||||||
// create certificate record
|
// create certificate record
|
||||||
const certificateData = {
|
const certificateData = {
|
||||||
address,
|
|
||||||
claimId: tx.claim_id,
|
claimId: tx.claim_id,
|
||||||
name : username,
|
name : username,
|
||||||
|
// address,
|
||||||
};
|
};
|
||||||
logger.debug('certificateData >', certificateData);
|
logger.debug('certificateData >', certificateData);
|
||||||
// save user and certificate to db
|
// save user and certificate to db
|
||||||
|
|
|
@ -72,8 +72,9 @@ app.set('view engine', 'handlebars');
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
res.locals.user = {
|
res.locals.user = {
|
||||||
id : req.user.id,
|
id : req.user.id,
|
||||||
channelName: req.user.channelName,
|
channelName : req.user.channelName,
|
||||||
|
channelClaimId: req.user.channelClaimId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
{{/ifConditional}}
|
{{/ifConditional}}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
<p>{{fileInfo.description}}</>
|
<p>{{fileInfo.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2 class="subheader">Metadata</h2>
|
<h2 class="subheader">Metadata</h2>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{{#if user}}
|
{{#if user}}
|
||||||
<option value="{{user.channelName}}" >{{user.channelName}}</option>
|
<option value="{{user.channelName}}" >{{user.channelName}}</option>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<option value="@speech" >Anonymous</option>
|
<option value="none" >None</option>
|
||||||
<option value="login">Login</option>
|
<option value="login">Login</option>
|
||||||
<option value="new" >New</option>
|
<option value="new" >New</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<a href="/about" class="top-bar-right">help</a>
|
<a href="/about" class="top-bar-right">help</a>
|
||||||
|
|
||||||
{{#if user}}
|
{{#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>
|
<a href="/logout" class="top-bar-right">logout</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="/login" class="top-bar-right">login</a>
|
<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.