diff --git a/helpers/errorHandlers.js b/helpers/errorHandlers.js index af549e30..17d22eb9 100644 --- a/helpers/errorHandlers.js +++ b/helpers/errorHandlers.js @@ -43,5 +43,7 @@ module.exports = { } else { return error; } + useObjectPropertiesIfNoKeys (err) { + return useObjectPropertiesIfNoKeys(err); }, }; diff --git a/passport/local-login.js b/passport/local-login.js index 5ccb822c..9ca15c28 100644 --- a/passport/local-login.js +++ b/passport/local-login.js @@ -11,6 +11,7 @@ module.exports = new PassportLocalStrategy( }, (req, username, password, done) => { logger.debug(`verifying loggin attempt ${username} ${password}`); + let userInfo = {}; return db.User .findOne({where: {userName: username}}) .then(user => { @@ -23,9 +24,18 @@ module.exports = new PassportLocalStrategy( return done(null, false, {message: 'Incorrect username or password.'}); } logger.debug('user found:', user.dataValues); - return user.getChannel().then(channel => { - return done(null, user); - }); + userInfo['id'] = user.id; + userInfo['userName'] = user.userName; + return user.getChannel(); + }) + .then(channel => { + userInfo['channelName'] = channel.channelName; + userInfo['channelClaimId'] = channel.channelClaimId; + return db.getShortChannelIdFromLongChannelId(channel.channelClaimId, channel.channelName); + }) + .then(shortChannelId => { + userInfo['shortChannelId'] = shortChannelId; + return done(null, userInfo); }) .catch(error => { return done(error); diff --git a/passport/local-signup.js b/passport/local-signup.js index 23273180..18a854f3 100644 --- a/passport/local-signup.js +++ b/passport/local-signup.js @@ -11,7 +11,7 @@ module.exports = new PassportLocalStrategy( passReqToCallback: true, // we want to be able to read the post body message parameters in the callback }, (req, username, password, done) => { - logger.debug(`new channel signup request: ${username} ${password}`); + logger.debug(`new channel signup request. user: ${username} pass: ${password} .`); let user; // server-side validaton of inputs (username, password) diff --git a/public/assets/css/BEM.css b/public/assets/css/BEM.css deleted file mode 100644 index dfa8262e..00000000 --- a/public/assets/css/BEM.css +++ /dev/null @@ -1,276 +0,0 @@ - -/* GENERAL */ - - -/* TEXT */ - -body, button, input, textarea, label, select, option { - font-family: serif; -} - -p { - padding-left: 0.3em; -} - -.center-text { - text-align: center; -} - -.url-text { - margin:0px; - padding:0px; -} - -/* HEADERS */ - -h1 { - font-size: x-large; -} - -h2 { - font-size: medium; - margin-top: 1em; - border-top: 1px #999 solid; - background-color: lightgray; - padding: 6px; -} - -h3 { - color: black;; -} - -.h3--secondary { - color: lightgray; -} - -h4 { - padding: 3px; -} - -/* CONTAINERS */ - -.wrapper { - margin-left: 20%; - width:60%; -} - -.full { - clear: both; -} - -.main { - float: left; - width: 65%; - -} - -.panel { - overflow: auto; - word-wrap: break-word; -} - -.sidebar { - float: right; - width: 33%; -} - -footer { - display: inline-block; - width: 100%; - margin-bottom: 2px; - padding-bottom: 2px; - border-bottom: 1px lightgrey solid; - margin-top: 2px; - padding-top: 2px; - border-top: 1px lightgrey solid; - text-align: center; - color: grey; -} - -/* COLUMNS AND ROWS */ - -.col-left, .col-right { - overflow: auto; - margin: 0px; - width: 48%; -} - -.col-left { - padding: 5px 10px 5px 0px; - float: left; -} - -.col-right { - padding: 5px 0px 5px 10px; - float: right; -} - -.row { - padding: 1em 2% 1em 2%; - margin: 0px; - -} - -.row--wide { - padding-right: 0px; - padding-left: 0px; -} - -.row--thin { - padding-top: 0.5em; - padding-bottom: 0.5em; -} - -.top-bar { - margin: 2em 0px 2px 0px; - padding: 0px 0px 2px 0px; - border-bottom: 1px lightgrey solid; - overflow: auto; - text-align: right; - vertical-align: text-bottom; -} - - -.column { - display: inline-block; - padding: 0px; - margin: 0px; -} - -.column--1 { - width: 8%; -} - -.column--2 { - width: 16%; -} - -.column--3 { - width: 24%; -} - -.column--4 { - width: 32%; -} - -.column--5 { - width: 40%; -} - -.column--6 { - width: 48%; -} - -.column--7 { - width: 56%; -} - -.column--8 { - width: 64%; -} - -.column--9 { - width: 72%; -} - -.column--10 { - width: 80%; -} - -.column--11 { - width: 88%; -} - -.column--12 { - width: 96%; -} - -/* LINKS */ - -a, a:visited { - color: blue; - text-decoration: none; -} - -/* ERROR MESSAGES */ - -.info-message { - font-weight: bold; -} - -.info-message--success { - color: green; -} - -.info-message--failure { - color: red; -} - -/* INPUT FIELDS */ - -input:-webkit-autofill { - -webkit-box-shadow: 0 0 0px 1000px white inset; -} - -.label, .input-text, .select, .textarea { - font-size: medium; - padding: 0.3em; - outline: none; - border: 0px; - background-color: white; -} - -.input-text--primary, .select--primary, .textarea--primary { - border-bottom: 1px solid blue; -} - -.input-text--primary:focus, .select--primary:focus, .textarea--primary:focus { - border-bottom: 1px solid grey; -} - -.input-checkbox, .input-textarea { - border: 1px solid grey; -} - -/* BUTTONS */ - -button { - border: 1px solid black; - padding: 0.5em; - margin: 0.5em 0.3em 0.5em 0.3em; - color: black; - background-color: white; -} - -button:hover { - border: 1px solid blue; - color: white; - background-color: blue; -} - -button:active{ - border: 1px solid blue; - color: white; - background-color: white; -} - -/* TABLES */ - -table { - width: 100%; - text-align: left; -} - -/* other */ - -.stop-float { - clear: both; -} - -.toggle-link { - float: right; -} - -.wrap-words { - word-wrap: break-word; -} \ No newline at end of file diff --git a/public/assets/css/componentStyle.css b/public/assets/css/componentStyle.css deleted file mode 100644 index 9c043422..00000000 --- a/public/assets/css/componentStyle.css +++ /dev/null @@ -1,185 +0,0 @@ - -/* top bar */ -#logo, #title { - float: left; -} - -#logo { - height: 1.5em; -} - -#title { - margin: 2px 5px 2px 5px; -} - -.top-bar-left { - float: left; -} - -.top-bar-tagline { - font-style: italic; - color: grey; -} - -.top-bar-right { - margin-left: 0.5em; -} - -/* publish */ -#drop-zone { - border: 1px dashed lightgrey; - padding: 1em; - height: 13em; - background: #F5F0EF; -} - -#asset-preview-holder { - width: 100%; - margin-bottom: 1em; -} - -/* show routes */ -.show-asset { - width: 100%; - margin-bottom: 1em; - margin-top: 1em; -} - -.show-asset-lite { - margin: 0px; -} - -.panel.links { - font-size: small; -} - -input.link { - width: 80%; -} - -button.copy-button { - padding: 4px; - float: right; -} - -.share-option { - margin-bottom: 1em; -} - -.metadata-table { - font-size: small; - border-collapse: collapse; - margin-bottom: 1em; -} - -.metadata-row { - border-bottom: 1px solid lightgrey; - margin: 2px; -} - -.left-column { - width: 30%; - font-weight: bold; - vertical-align: top; -} - -/* trending claims */ -.grid-item { - width: 23%; - margin: 0px 1% 20px 1%; -} - -/* learn more */ -.learn-more { - text-align: center; - border-top: 1px solid lightgrey; -} - -/* examples */ -.example { - clear: both; - width: 100%; - margin-bottom: 15px; - overflow: auto; -} - -.example-image, .example-code { - float: left; - margin: 2%; -} - -.example-image { - width: 21%; -} - -.example-code { - float: right; - padding: 4%; - width: 62%; - background-color: lightgrey; - font-family: monospace; - color: #666; - word-wrap: break-word; -} - -/* contribute */ -#github-logo { - float: right; - height: 1em; -} - -/* content lists */ -.content-list-card { - margin-top: 2px; - padding-top: 2px; - border-top: 1px lightgrey solid; - overflow: auto; - position: relative; -} - -.content-list-card-link { - position:absolute; - width:100%; - height:100%; - top:0; - left: 0; - z-index: 1; -} - -.content-list-asset { - width: 20%; - float: left; - margin: 5px 30px 5px 0px; -} - -.content-list-title { - color: black; - font-weight: bold; -} - -.content-list-details { - word-wrap: break-word; -} - -.content-list-details > ul { - position: relative; - z-index: 2; - list-style: none; - list-style-type: none; -} - -.content-list-card:hover { - background-color: #F5F0EF; -} - -/* statistics */ -.totals-row { - border-top: 1px solid grey; - border-bottom: 1px solid grey; - font-weight: bold; -} -.stats-table-url { - word-wrap: break-word; -} - - diff --git a/public/assets/css/general.css b/public/assets/css/general.css new file mode 100644 index 00000000..ae3f4da3 --- /dev/null +++ b/public/assets/css/general.css @@ -0,0 +1,516 @@ +html, body { + margin: 0; + padding: 0; + height: 100%; +} +/* TEXT */ + +body, button, input, textarea, label, select, option { + font-family: monospace; + font-size: large; + word-wrap: break-word; +} + +p { + padding-left: 0.3em; +} + +.center-text { + text-align: center; +} + +.url-text { + margin:0px; + padding:0px; +} + +.url-text--primary { + color: black; +} + +.url-text--secondary { + color: lightgrey; +} + +.pull-quote { + font-size: 3rem; +} + +/* TOOL TIPS */ +/* Tooltip container */ +.tooltip { + position: relative; +} +/* Tooltip text */ +.tooltip > .tooltip-text { + visibility: hidden; + width: 15em; + background-color: dodgerblue; + color: #fff; + text-align: center; + padding: 0.5em; + /* Position the tooltip text */ + position: absolute; + z-index: 1; + bottom: 110%; + left: 50%; + margin-left: -8em; /* Use half of the width (120/2 = 60), to center the tooltip */ +} +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip:hover > .tooltip-text { + visibility: visible; +} +/* arrow at bottom of tooltip text */ +.tooltip > .tooltip-text::after { + content: " "; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: dodgerblue transparent transparent transparent; +} + +/* LINKS */ + +a, a:visited { + text-decoration: none; +} + +/* HEADERS */ + +h1 { + font-size: 2rem; +} + +h2 { + font-size: 1.5rem; +} + +.h2--secondary { + font-weight: normal; + color: lightgrey; +} + +.h2--top { + margin-top: 0px; +} + +h3 { + font-size: 1rem; + font-weight: normal; +} + +/* COLUMNS AND ROWS */ + +.row { + clear: both; + padding: 2rem 2rem 2rem 2rem; + margin: 0px; +} + +.row--wide { + padding-right: 0px; + padding-left: 0px; +} + +.row--short { + padding-top: 0px; + padding-bottom: 0px; +} + +.row--full-height { + height: calc(100% - 9rem); +} + +.column { + display: inline-block; + padding: 0px; + margin: 0px; +} + +.column--1 { + width: 10%; +} + +.column--2 { + width: 20%; +} + +.column--3 { + width: 30%; +} + +.column--4 { + width: 40%; +} + +.column--5 { + width: 50%; +} + +.column--6 { + width: 60%; +} + +.column--7 { + width: 70%; +} + +.column--8 { + width: 80%; +} + +.column--9 { + width: 90%; +} + +.column--10 { + width: 100%; +} + +/* ALIGNMENT */ +.align-content-left { + text-align: left; +} + +.align-content-center { + text-align: center; +} + +.align-content-right { + text-align: right; +} + +.align-content-top { + vertical-align: top; +} + +.align-content-right { + vertical-align: bottom; +} + +/* ERROR MESSAGES */ + +.info-message { + font-weight: bold; +} + +.info-message--success { + color: green; +} + +.info-message--failure { + color: red; +} + +/* INPUT FIELDS */ + +/* blocks */ +input:-webkit-autofill { + -webkit-box-shadow: 0 0 0px 1000px white inset; +} + +.label, .input-text, .select, .textarea { + margin: 0px; + padding: 0.3em; + outline: none; + border: 0px; + background-color: white; +} + +.input-disabled { + border: 1px solid black; + padding: 0.5em; + margin: 0px; + color: black; + background-color: white; +} + +option { + font-family: monospace; +} + + +.input-checkbox { + border: 1px solid grey; + background: white; +} + +.input-file { + width: 0.1px; + height: 0.1px; + opacity: 0; + overflow: hidden; + position: absolute; + z-index: -1; +} + +.input-file-label { + color: dodgerblue; + text-decoration: underline; + cursor: pointer; +} + +.select--no-arrow { + -moz-appearance:none; + -webkit-appearance: none; + cursor: pointer; +} + +.select--arrow { + -moz-appearance:none; + -webkit-appearance: none; + background: url('../img/down_triangle.png') no-repeat right; + padding-right: 1em; +} + +/* modifiers */ +.input-text--primary, .select--primary, .textarea--primary { + border-bottom: 1px solid dodgerblue; +} + +.input-text--primary:focus, .select--primary:focus, .textarea--primary:focus { + border-bottom: 1px solid dodgerblue; +} + +.input-text--large, .select--large, .textarea--large { + font-size: 1.5rem; + border-left: 1px solid dodgerblue; +} + +.input-text--large:focus, .select--large:focus, .textarea--large:focus { + border-left: 1px solid dodgerblue; +} + +.input-text--full-width, .textarea--full-width { + width: calc(100% - 0.6em); +} + +.input-disabled--full-width { + width: calc(100% - 1em - 2px); +} + +/* BUTTONS */ + +button { + cursor: pointer; +} + +.button--primary { + border: 1px solid black; + padding: 0.5em; + margin: 0.5em 0.3em 0.5em 0.3em; + color: black; + background-color: white; +} + +.button--primary:hover { + border: 1px solid dodgerblue; + color: white; + background-color: dodgerblue; +} + +.button--primary:active{ + border: 1px solid dodgerblue; + color: white; + background-color: white; +} + +.button--large{ + margin: 0px; + width: calc(100% - 2px); + padding: 2rem; + font-size: x-large; +} + +.button--cancel{ + border: 0px; + background-color: white; + color: grey; +} + +/* TABLES */ + +table { + width: 100%; + text-align: left; +} + +/* NAV BAR */ + +.nav-bar { + height: 5rem; +} + +.nav-bar-title-section, .nav-bar-link-section { + padding: 0px 1em 0px 1em; +} + +.nav-bar-title-section { + overflow: hidden; + border-bottom: 2px solid #eaeaea; + position: relative; +} + +.nav-bar-link-section { + position: absolute; + bottom: 0px; + right: 0px; + z-index: 1; +} + +.nav-bar-logo, .nav-bar-title, .nav-bar-link { + padding: 2rem 0.5rem 1.5rem 0.5rem; + display: inline-block; + color: black; +} + +.nav-bar-title--superscript { + font-size: small; + vertical-align: top; +} + +.nav-bar-link { + border-bottom: 2px solid white; +} +.nav-bar-link--active { + color: #1e90ff; + border-bottom: 2px solid #1e90ff; +} + +/* PUBLISH FORM */ + +.dropzone { + border: 2px dashed lightgrey; + text-align: center; +} + +.dropzone:hover { + border: 2px dashed #1e90ff; +} + +#primary-dropzone-wrapper, #publish-form-wrapper { + height: 100%; +} + +#primary-dropzone { + height: calc(100% - 4px); + position: relative; +} + +#asset-preview-holder { + position: relative; +} + +#primary-dropzone-instructions, #preview-dropzone-instructions { + position: absolute; + top: 40%; + left: 50%; + transform: translateX(-50%) translateY(-40%); +} + +#asset-preview { + display: block; + padding: 0.5rem; + width: calc(100% - 1rem); +} + +/* Show page */ + +.asset-display { + display: block; + width: 100%; +} + +/* item lists */ + +.content-list-item { + +} + +.content-list-item-asset { + width: 90%; +} + +.content-list-item-link { + +} + +/* other */ + +.toggle-link { + float: right; +} + +.wrap-words { + word-wrap: break-word; +} + +/* Social Sharing Icons */ + + .button { + margin-right: 10px; + max-width: 100px; + display: inline; + padding: 8px; +} + +a.reddit-share.button img { + width: 38px; + height: 38px;} + +.row--short img { + width: 40px; + height: 40px; +} + +.row--short img:hover { + -webkit-animation: animation 20000ms linear both; + animation: animation 20000ms linear both; +} + +@-webkit-keyframes animation { + 0% { -webkit-transform: matrix3d(-0.5, -0.866, 0, 0, 0.866, -0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.5, -0.866, 0, 0, 0.866, -0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.16% { -webkit-transform: matrix3d(-0.493, -0.875, 0, 0, 0.769, -0.646, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.493, -0.875, 0, 0, 0.769, -0.646, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.32% { -webkit-transform: matrix3d(-0.546, -0.846, 0, 0, 0.699, -0.724, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.546, -0.846, 0, 0, 0.699, -0.724, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.64% { -webkit-transform: matrix3d(-0.703, -0.715, 0, 0, 0.603, -0.801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.703, -0.715, 0, 0, 0.603, -0.801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.95% { -webkit-transform: matrix3d(-0.836, -0.55, 0, 0, 0.509, -0.861, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.836, -0.55, 0, 0, 0.509, -0.861, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 1.26% { -webkit-transform: matrix3d(-0.924, -0.383, 0, 0, 0.384, -0.923, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.924, -0.383, 0, 0, 0.384, -0.923, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 1.57% { -webkit-transform: matrix3d(-0.974, -0.225, 0, 0, 0.236, -0.972, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.974, -0.225, 0, 0, 0.236, -0.972, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 2.82% { -webkit-transform: matrix3d(-0.919, 0.394, 0, 0, -0.394, -0.919, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.919, 0.394, 0, 0, -0.394, -0.919, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 4.07% { -webkit-transform: matrix3d(-0.538, 0.843, 0, 0, -0.843, -0.538, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.538, 0.843, 0, 0, -0.843, -0.538, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 4.3% { -webkit-transform: matrix3d(-0.447, 0.894, 0, 0, -0.894, -0.447, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.447, 0.894, 0, 0, -0.894, -0.447, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 5% { -webkit-transform: matrix3d(-0.161, 0.987, 0, 0, -0.987, -0.161, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.161, 0.987, 0, 0, -0.987, -0.161, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 8.61% { -webkit-transform: matrix3d(0.873, 0.487, 0, 0, -0.487, 0.873, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.873, 0.487, 0, 0, -0.487, 0.873, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 12.91% { -webkit-transform: matrix3d(0.976, -0.217, 0, 0, 0.217, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.976, -0.217, 0, 0, 0.217, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 17.22% { -webkit-transform: matrix3d(0.925, -0.381, 0, 0, 0.381, 0.925, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.925, -0.381, 0, 0, 0.381, 0.925, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 28.33% { -webkit-transform: matrix3d(0.996, -0.086, 0, 0, 0.086, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.996, -0.086, 0, 0, 0.086, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 39.44% { -webkit-transform: matrix3d(1, 0.026, 0, 0, -0.026, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0.026, 0, 0, -0.026, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 61.66% { -webkit-transform: matrix3d(1, -0.002, 0, 0, 0.002, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, -0.002, 0, 0, 0.002, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 83.98% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 100% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } +} + +@keyframes animation { + 0% { -webkit-transform: matrix3d(-0.5, -0.866, 0, 0, 0.866, -0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.5, -0.866, 0, 0, 0.866, -0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.16% { -webkit-transform: matrix3d(-0.493, -0.875, 0, 0, 0.769, -0.646, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.493, -0.875, 0, 0, 0.769, -0.646, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.32% { -webkit-transform: matrix3d(-0.546, -0.846, 0, 0, 0.699, -0.724, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.546, -0.846, 0, 0, 0.699, -0.724, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.64% { -webkit-transform: matrix3d(-0.703, -0.715, 0, 0, 0.603, -0.801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.703, -0.715, 0, 0, 0.603, -0.801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 0.95% { -webkit-transform: matrix3d(-0.836, -0.55, 0, 0, 0.509, -0.861, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.836, -0.55, 0, 0, 0.509, -0.861, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 1.26% { -webkit-transform: matrix3d(-0.924, -0.383, 0, 0, 0.384, -0.923, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.924, -0.383, 0, 0, 0.384, -0.923, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 1.57% { -webkit-transform: matrix3d(-0.974, -0.225, 0, 0, 0.236, -0.972, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.974, -0.225, 0, 0, 0.236, -0.972, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 2.82% { -webkit-transform: matrix3d(-0.919, 0.394, 0, 0, -0.394, -0.919, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.919, 0.394, 0, 0, -0.394, -0.919, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 4.07% { -webkit-transform: matrix3d(-0.538, 0.843, 0, 0, -0.843, -0.538, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.538, 0.843, 0, 0, -0.843, -0.538, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 4.3% { -webkit-transform: matrix3d(-0.447, 0.894, 0, 0, -0.894, -0.447, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.447, 0.894, 0, 0, -0.894, -0.447, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 5% { -webkit-transform: matrix3d(-0.161, 0.987, 0, 0, -0.987, -0.161, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(-0.161, 0.987, 0, 0, -0.987, -0.161, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 8.61% { -webkit-transform: matrix3d(0.873, 0.487, 0, 0, -0.487, 0.873, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.873, 0.487, 0, 0, -0.487, 0.873, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 12.91% { -webkit-transform: matrix3d(0.976, -0.217, 0, 0, 0.217, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.976, -0.217, 0, 0, 0.217, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 17.22% { -webkit-transform: matrix3d(0.925, -0.381, 0, 0, 0.381, 0.925, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.925, -0.381, 0, 0, 0.381, 0.925, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 28.33% { -webkit-transform: matrix3d(0.996, -0.086, 0, 0, 0.086, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.996, -0.086, 0, 0, 0.086, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 39.44% { -webkit-transform: matrix3d(1, 0.026, 0, 0, -0.026, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0.026, 0, 0, -0.026, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 61.66% { -webkit-transform: matrix3d(1, -0.002, 0, 0, 0.002, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, -0.002, 0, 0, 0.002, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 83.98% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } + 100% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } +} diff --git a/public/assets/css/mediaQueries.css b/public/assets/css/mediaQueries.css index 6a36df91..227e1e4f 100644 --- a/public/assets/css/mediaQueries.css +++ b/public/assets/css/mediaQueries.css @@ -1,15 +1,5 @@ -@media (max-width: 1250px) { - .wrapper { - margin-left: 10%; - width:80%; - } -} @media (max-width: 1000px) { - .wrapper { - margin-left: 10%; - width:80%; - } .main { float: none; @@ -28,32 +18,50 @@ } @media (max-width: 750px ) { - .col-left, .col-right { - float: none; - margin: 0px; - padding: 0px; + + .column--med-10 { width: 100%; } - .col-right { - padding-top: 20px; - } - - .all-claims-asset { - width:30%; - } - - .all-claims-details { - font-size: small; - } - - .show-asset-lite { - width: 100%; - } - - .top-bar-tagline { - clear: both; - text-align: left; - width: 100%; + .h2--top { + margin-top: 1em; } } + + +@media (max-width: 475px) { + + .nav-bar { + height: 8rem; + } + + .nav-bar-title { + padding-bottom: 0px; + } + + .nav-bar-link-section { + position: relative; + padding-left: 0px; + } + + .row--full-height { + + height: calc(100% - 11rem); + } + + .column--sml-10 { + width: 100%; + } + + #publish-active-area > .row, #details-detail > .row, #channel-login-form > .row, #publish-channel-form > .row { + padding: 1em 0px 1em 0px; + } +} + +@media (max-width: 350px) { + + body, button, input, textarea, label, select, option { + font-size: medium; + } + +} \ No newline at end of file diff --git a/public/assets/img/black_video_play.jpg b/public/assets/img/black_video_play.jpg new file mode 100644 index 00000000..17cfdd8a Binary files /dev/null and b/public/assets/img/black_video_play.jpg differ diff --git a/public/assets/img/content-freedom-large.png b/public/assets/img/content-freedom-large.png index a352c3c8..318746da 100644 Binary files a/public/assets/img/content-freedom-large.png and b/public/assets/img/content-freedom-large.png differ diff --git a/public/assets/img/down_triangle.png b/public/assets/img/down_triangle.png new file mode 100644 index 00000000..c5f5544a Binary files /dev/null and b/public/assets/img/down_triangle.png differ diff --git a/public/assets/img/upload_arrow.png b/public/assets/img/upload_arrow.png new file mode 100644 index 00000000..4036932f Binary files /dev/null and b/public/assets/img/upload_arrow.png differ diff --git a/public/assets/js/generalFunctions.js b/public/assets/js/generalFunctions.js index d19f35ec..953eb3b8 100644 --- a/public/assets/js/generalFunctions.js +++ b/public/assets/js/generalFunctions.js @@ -6,10 +6,10 @@ function getRequest (url) { xhttp.responseType = 'json'; xhttp.onreadystatechange = () => { if (xhttp.readyState == 4 ) { - console.log(xhttp); if ( xhttp.status == 200) { - console.log('response:', xhttp.response); resolve(xhttp.response); + } else if (xhttp.status == 401) { + reject('wrong username or password'); } else { reject('request failed with status:' + xhttp.status); }; @@ -28,10 +28,10 @@ function postRequest (url, params) { xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhttp.onreadystatechange = () => { if (xhttp.readyState == 4 ) { - console.log(xhttp); if ( xhttp.status == 200) { - console.log('response:', xhttp.response); resolve(xhttp.response); + } else if (xhttp.status == 401) { + reject('wrong username or password'); } else { reject('request failed with status:' + xhttp.status); }; @@ -80,6 +80,31 @@ function createProgressBar(element, size){ setInterval(addOne, 300); } +function getCookie(cname) { + const name = cname + "="; + const decodedCookie = decodeURIComponent(document.cookie); + const ca = decodedCookie.split(';'); + for(let i = 0; i loading preview...` + } previewReader.readAsDataURL(selectedFile); previewReader.onloadend = function () { - dropzone.style.display = 'none'; - previewHolder.style.display = 'block'; - previewHolder.innerHTML = 'image preview'; + assetPreview.innerHTML = 'image preview'; }; + } else { + assetPreview.innerHTML = `` } + // hide the drop zone + primaryDropzone.hidden = true; + publishForm.hidden = false; // set the name input value to the image name if none is set yet if (nameInput.value === "") { var filename = selectedFile.name.substring(0, selectedFile.name.indexOf('.')) @@ -68,26 +49,44 @@ function previewAndStageFile(selectedFile){ } // Validate the publish submission and then trigger publishing. -function publishSelectedImage(event) { - var claimName = document.getElementById('claim-name-input').value; - var channelName = document.getElementById('channel-name-select').value; +function publishStagedFile(event) { // prevent default so this script can handle submission event.preventDefault(); + // declare variables + const claimName = document.getElementById('claim-name-input').value; + let channelName = document.getElementById('channel-name-select').value; + const fileSelectionError = document.getElementById('input-error-file-selection'); + const claimNameError = document.getElementById('input-error-claim-name'); + const channelSelectError = document.getElementById('input-error-channel-select'); + const publishSubmitError = document.getElementById('input-error-publish-submit'); + let anonymousOrInChannel; + // replace channelName with 'anonymous' if needed + const radios = document.getElementsByName('anonymous-or-channel'); + for (let i = 0; i < radios.length; i++) { + if (radios[i].checked) { + // do whatever you want with the checked radio + anonymousOrInChannel = radios[i].value; + // only one radio can be logically checked, don't check the rest + break; + } + } + if (anonymousOrInChannel === 'anonymous') {channelName = 'anonymous'}; + console.log('channel name:', channelName); // validate, submit, and handle response validateFilePublishSubmission(stagedFiles, claimName, channelName) .then(() => { - uploader.submitFiles(stagedFiles); + uploader.submitFiles(stagedFiles); }) .catch(error => { if (error.name === 'FileError') { - showError(document.getElementById('input-error-file-selection'), error.message); + showError(fileSelectionError, error.message); } else if (error.name === 'NameError') { - showError(document.getElementById('input-error-claim-name'), error.message); + showError(claimNameError, error.message); } else if (error.name === 'ChannelNameError'){ console.log(error); - showError(document.getElementById('input-error-channel-select'), error.message); + showError(channelSelectError, error.message); } else { - showError(document.getElementById('input-error-publish-submit'), error.message); + showError(publishSubmitError, error.message); } return; }) diff --git a/public/assets/js/validationFunctions.js b/public/assets/js/validationFunctions.js index 34ce67d6..83f6ff71 100644 --- a/public/assets/js/validationFunctions.js +++ b/public/assets/js/validationFunctions.js @@ -1,5 +1,3 @@ - - // validation function which checks the proposed file's type, size, and name function validateFile(file) { if (!file) { diff --git a/routes/auth-routes.js b/routes/auth-routes.js index 39c0ef0f..9e2dd361 100644 --- a/routes/auth-routes.js +++ b/routes/auth-routes.js @@ -9,7 +9,13 @@ module.exports = (app) => { }); // route for log in app.post('/login', passport.authenticate('local-login'), (req, res) => { + logger.debug(req.user); logger.debug('successful login'); - res.status(200).json(true); + res.status(200).json({ + success : true, + channelName : req.user.channelName, + channelClaimId: req.user.channelClaimId, + shortChannelId: req.user.shortChannelId, + }); }); }; diff --git a/routes/page-routes.js b/routes/page-routes.js index 855198bf..14e6682f 100644 --- a/routes/page-routes.js +++ b/routes/page-routes.js @@ -31,7 +31,7 @@ module.exports = (app) => { getTrendingClaims(dateTime) .then(result => { // logger.debug(result); - res.status(200).render('trending', { + res.status(200).render('popular', { trendingAssets: result, }); }) diff --git a/routes/sockets-routes.js b/routes/sockets-routes.js index b983be46..6b523c41 100644 --- a/routes/sockets-routes.js +++ b/routes/sockets-routes.js @@ -48,17 +48,17 @@ module.exports = (app, siofu, hostedContentPath) => { // publish the file publish(publishParams, file.name, file.meta.type) .then(result => { - postToStats('PUBLISH', '/', null, null, null, 'success'); socket.emit('publish-complete', { name: publishParams.name, result }); + postToStats('PUBLISH', '/', null, null, null, 'success'); }) .catch(error => { - error = errorHandlers.handlePublishError(error); - postToStats('PUBLISH', '/', null, null, null, error); socket.emit('publish-failure', error); + logger.error('Publish Error:', useObjectPropertiesIfNoKeys(error)); + postToStats('PUBLISH', '/', null, null, null, error); }); } else { - logger.error(`An error occurred in uploading the client's file`); socket.emit('publish-failure', 'File uploaded, but with errors'); + logger.error(`An error occurred in uploading the client's file`); postToStats('PUBLISH', '/', null, null, null, 'File uploaded, but with errors'); // to-do: remove the file, if not done automatically } diff --git a/speech.js b/speech.js index 082c64a6..fac70d36 100644 --- a/speech.js +++ b/speech.js @@ -61,7 +61,7 @@ passport.deserializeUser((id, done) => { // this populates req.user .then(shortChannelId => { userInfo['shortChannelId'] = shortChannelId; done(null, userInfo); - return null; + return null; // note: why return null and not the done? }) .catch(error => { logger.error('sequelize error', error); @@ -85,7 +85,7 @@ app.set('view engine', 'handlebars'); // middleware to pass user info back to client (for handlebars access), if user is logged in app.use((req, res, next) => { if (req.user) { - logger.verbose(req.user); + // logger.verbose(req.user); res.locals.user = { id : req.user.id, userName : req.user.userName, diff --git a/views/about.handlebars b/views/about.handlebars index 9600c2f0..05d17b87 100644 --- a/views/about.handlebars +++ b/views/about.handlebars @@ -1,17 +1,31 @@ -
{{> topBar}} -
-

About Spee.ch

-

Spee.ch is a single-serving site that reads and publishes images to and from the LBRY blockchain.

-

Spee.ch is an image hosting service, but with the added benefit that it stores your images on a decentralized network of computers -- the LBRY network. This means that your images are stored in multiple locations without a single point of failure.

- {{> examples}} - {{> documentation}} - {{> bugs}} -
- - {{> footer}} -
+
+
+
+ Open-source, decentralized image and video hosting +
+
+

+ GITHUB +

+

+ SLACK CHANNEL +

+

+ DOCUMENTATION +

+
+
+
+

Spee.ch is a media-hosting site that reads and publishes content from the LBRY blockchain.

+

Spee.ch is a hosting service, but with the added benefit that it stores your content on a decentralized network of computers -- the LBRY network. This means that your images are stored in multiple locations without a single point of failure.

+

[Contribute]

+

Spee.ch is an open source project. Please contribute to the existing site, or fork it and make your own!

+

If you have an idea for your own spee.ch-like site on top of LBRY, fork our github repo and go to town!

+

If you want to improve spee.ch, join our slack channel or solve one of our github issues.

+
+
+
+ \ No newline at end of file diff --git a/views/channel.handlebars b/views/channel.handlebars index 9434af0c..9c1733fc 100644 --- a/views/channel.handlebars +++ b/views/channel.handlebars @@ -1,11 +1,8 @@ -
- {{> topBar}} -
-

{{this.channelName}}:{{this.longChannelId}}

-

Below is all the free content in this channel.

- {{#each this.claims}} - {{> contentListItem}} - {{/each}} -
- {{> footer}} +{{> topBar}} +
+

{{this.channelName}}:{{this.longChannelId}}

+

Below is all the free content in this channel.

+ {{#each this.claims}} + {{> contentListItem}} + {{/each}}
diff --git a/views/fourOhFour.handlebars b/views/fourOhFour.handlebars index cc91ea9f..b3b88595 100644 --- a/views/fourOhFour.handlebars +++ b/views/fourOhFour.handlebars @@ -1,7 +1,6 @@ -
+ {{> topBar}}

404: Not Found

That page does not exist. Return home.

-
\ No newline at end of file diff --git a/views/index.handlebars b/views/index.handlebars index 1e1bc2e1..4fc1a6c1 100644 --- a/views/index.handlebars +++ b/views/index.handlebars @@ -1,25 +1,111 @@ -
-
-
- {{> topBar}} - {{> publishForm}} - {{> learnMore}} - {{> footer}} +{{> topBar}} +
+
+
+
+
+

Drag & drop image or video here

+

OR

+
+ + +
+
+ +
+
+
+ + diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars index ea4184b4..21cffac9 100644 --- a/views/layouts/main.handlebars +++ b/views/layouts/main.handlebars @@ -6,8 +6,7 @@ Spee.ch - - + diff --git a/views/layouts/show.handlebars b/views/layouts/show.handlebars index d0130e4b..2b001897 100644 --- a/views/layouts/show.handlebars +++ b/views/layouts/show.handlebars @@ -6,8 +6,7 @@ Spee.ch - - + {{#unless fileInfo.nsfw}} diff --git a/views/login.handlebars b/views/login.handlebars index 7309d518..5a60183a 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -1,21 +1,13 @@ -
- {{> topBar}} -

Log In

-
+{{> topBar}} -
-

Log in to an existing channel:

- {{>channelLoginForm}} -
+
+
+

Log in to an existing channel:

+ {{>channelLoginForm}} +
+

Create a brand new channel:

+ {{>channelCreationForm}}
-

Create New

-
-
-

Create a brand new channel:

- {{>channelCreationForm}} -
-
- {{> footer}}
diff --git a/views/new.handlebars b/views/new.handlebars index cf34c851..3e8870c7 100644 --- a/views/new.handlebars +++ b/views/new.handlebars @@ -1,4 +1,4 @@ -
+ {{> topBar}}

New on Spee.ch

@@ -22,5 +22,3 @@
{{/each}}
- {{> footer}} -
\ No newline at end of file diff --git a/views/noChannel.handlebars b/views/noChannel.handlebars index 585c0298..3b68d168 100644 --- a/views/noChannel.handlebars +++ b/views/noChannel.handlebars @@ -1,8 +1,7 @@ -
+ {{> topBar}}

No Claims

There are no free assets on this channel.

If you think this message is an error, contact us in the LBRY slack!

-
\ No newline at end of file diff --git a/views/noClaims.handlebars b/views/noClaims.handlebars index 9e918fa8..e1f01bda 100644 --- a/views/noClaims.handlebars +++ b/views/noClaims.handlebars @@ -1,8 +1,7 @@ -
+ {{> topBar}}

No Claims

There are no free assets at that claim. You should publish one at spee.ch.

NOTE: it is possible your claim was published, but it is still being processed by the blockchain

-
\ No newline at end of file diff --git a/views/partials/asset.handlebars b/views/partials/asset.handlebars index a963b07d..3b903df2 100644 --- a/views/partials/asset.handlebars +++ b/views/partials/asset.handlebars @@ -1,23 +1,19 @@ - \ No newline at end of file + +{{#ifConditional fileInfo.fileType '===' 'video/mp4'}} + {{#ifConditional fileInfo.fileExt '===' 'gifv'}} + + {{else}} + + {{/ifConditional}} +{{else}} + +{{/ifConditional}} + \ No newline at end of file diff --git a/views/partials/assetInfo.handlebars b/views/partials/assetInfo.handlebars index b485bc69..60540d22 100644 --- a/views/partials/assetInfo.handlebars +++ b/views/partials/assetInfo.handlebars @@ -1,76 +1,92 @@ -
-

Title

-

{{fileInfo.title}} +

Title

+
+ {{fileInfo.title}}
-