redirect on publish is working
This commit is contained in:
parent
90da7a3637
commit
3186e667a2
7 changed files with 59 additions and 34 deletions
|
@ -14,7 +14,7 @@
|
|||
|
||||
.main {
|
||||
float: left;
|
||||
width: 75%;
|
||||
width: 65%;
|
||||
margin-right: 1%;
|
||||
padding-right: 1%;
|
||||
border-right: 1px lightgrey solid;
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
.sidebar {
|
||||
float: left;
|
||||
width: 22%;
|
||||
width: 32%;
|
||||
}
|
||||
|
||||
footer {
|
||||
|
@ -105,6 +105,10 @@ table {
|
|||
float: right;
|
||||
}
|
||||
|
||||
.wrap-words {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
@media (max-width: 1250px) {
|
||||
|
||||
.wrapper {
|
||||
|
|
|
@ -16,7 +16,16 @@
|
|||
|
||||
.show-image, .show-video {
|
||||
width: 100%;
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
||||
.table-metadata {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.left-column {
|
||||
width: 30%;
|
||||
font-weight: bold;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* learn more */
|
||||
|
@ -37,16 +46,17 @@
|
|||
|
||||
.example-image, .example-code {
|
||||
float: left;
|
||||
margin: 5px 15px 5px 0px;
|
||||
margin: 2%;
|
||||
}
|
||||
|
||||
.example-image {
|
||||
width: 20%;
|
||||
width: 21%;
|
||||
}
|
||||
|
||||
.example-code {
|
||||
padding: 2em;
|
||||
width: 60%;
|
||||
float: right;
|
||||
padding: 4%;
|
||||
width: 62%;
|
||||
background-color: lightgrey;
|
||||
font-family: monospace;
|
||||
color: #666;
|
||||
|
|
|
@ -168,26 +168,9 @@ socket.on('publish-complete', function(msg){
|
|||
var publishResults;
|
||||
var directUrl = '/' + msg.name + '/' + msg.result.claim_id;
|
||||
// build new publish area
|
||||
publishResults = '<p>Your publish is complete! View it here:</p>';
|
||||
publishResults += '<p><a target="_blank" href="' + directUrl + '">spee.ch' + directUrl + '</a></p>';
|
||||
publishResults += '<p><button class="copy-button">Copy to clipboard</button></p>';
|
||||
publishResults += '<p><a target="_blank" href="https://explorer.lbry.io/#!/transaction/' + msg.result.txid + '">View the transaction details</a></p>';
|
||||
publishResults += '<a href="/"><button>Reload</button></a></p>';
|
||||
publishResults = '<p>Your publish is complete! You are being redicted to it</p>';
|
||||
publishResults += '<p><a target="_blank" href="' + directUrl + '">if you do not get redirected, click here</a></p>';
|
||||
// update publish area
|
||||
document.getElementById('publish-active-area').innerHTML = publishResults;
|
||||
// update the link holder
|
||||
document.getElementById('direct-link-holder').innerText = 'https://spee.ch' + directUrl;
|
||||
// enable copy-to-clipboard
|
||||
var copyBtn = document.querySelector('.copy-button');
|
||||
copyBtn.addEventListener('click', function(event) {
|
||||
// select the text
|
||||
var text = document.getElementById('direct-link-holder');
|
||||
text.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'successful' : 'unsuccessful';
|
||||
} catch (err) {
|
||||
alert('Oops, unable to copy');
|
||||
}
|
||||
});
|
||||
window.location.href = directUrl;
|
||||
});
|
|
@ -31,10 +31,10 @@ function serveFile ({ fileName, fileType, filePath }, res) {
|
|||
res.status(200).sendFile(filePath, options);
|
||||
}
|
||||
|
||||
function servePage ({ fileName, filePath }, res) {
|
||||
logger.debug(`serving show page for ${fileName}`);
|
||||
function servePage (fileInfo, res) {
|
||||
logger.debug(`serving show page for ${fileInfo.fileName}`);
|
||||
// set default options
|
||||
res.status(200).render('show', { filePath });
|
||||
res.status(200).render('show', { fileInfo });
|
||||
}
|
||||
|
||||
function sendAnalyticsAndLog (headers, ip, originalUrl) {
|
||||
|
@ -61,6 +61,7 @@ module.exports = (app) => {
|
|||
const mimetypes = headers['accept'].split(',');
|
||||
if (mimetypes.includes('text/html')) {
|
||||
postToStats('show', originalUrl, ip, 'success');
|
||||
logger.debug('fileInfo', fileInfo);
|
||||
servePage(fileInfo, res);
|
||||
} else {
|
||||
postToStats('serve', originalUrl, ip, 'success');
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<div class="panel">
|
||||
<div id="asset-placeholder" data-filepath="{{{filePath}}}">
|
||||
<p> video loading... </p>
|
||||
<h2>{{fileInfo.name}}</h2>
|
||||
<div id="asset-placeholder" data-filepath="{{{fileInfo.filePath}}}">
|
||||
<p> loading... </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<div class="panel">
|
||||
<h2>links</h2>
|
||||
<p>links go here</p>
|
||||
<table class="table-metadata" style="table-layout: fixed">
|
||||
<tr>
|
||||
<td class="left-column">Direct Link:</td>
|
||||
<td><a href="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}">https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-column">Embed:</td>
|
||||
<td><code><img src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" /></code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
|
@ -1,4 +1,21 @@
|
|||
<div class="panel">
|
||||
<h2>metadata</h2>
|
||||
<p>metadata goes here</p>
|
||||
<table class="table-metadata" style="table-layout: fixed">
|
||||
<tr>
|
||||
<td class="left-column">Name</td>
|
||||
<td>{{fileInfo.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-column">Claim Id</td>
|
||||
<td>{{fileInfo.claimId}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-column">File Name</td>
|
||||
<td>{{fileInfo.fileName}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left-column">fileType</td>
|
||||
<td>{{fileInfo.fileType}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
Loading…
Reference in a new issue