updated show route with short url
This commit is contained in:
parent
af8242a3c6
commit
13471edda4
4 changed files with 40 additions and 42 deletions
|
@ -208,7 +208,7 @@ module.exports = {
|
||||||
updateFileIfNeeded(uri, name, claimId, result.dataValues.outpoint, result.dataValues.outpoint);
|
updateFileIfNeeded(uri, name, claimId, result.dataValues.outpoint, result.dataValues.outpoint);
|
||||||
// 3. if a match was not found use the daemon to retrieve the claim & return the db data once it is created
|
// 3. if a match was not found use the daemon to retrieve the claim & return the db data once it is created
|
||||||
} else {
|
} else {
|
||||||
logger.debug('No result found in File table,');
|
logger.debug('No result found in File table');
|
||||||
lbryApi
|
lbryApi
|
||||||
.resolveUri(uri)
|
.resolveUri(uri)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
|
|
15
server.js
15
server.js
|
@ -5,13 +5,13 @@ const siofu = require('socketio-file-upload');
|
||||||
const expressHandlebars = require('express-handlebars');
|
const expressHandlebars = require('express-handlebars');
|
||||||
const Handlebars = require('handlebars');
|
const Handlebars = require('handlebars');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const winston = require('winston');
|
const logger = require('winston');
|
||||||
|
|
||||||
const hostedContentPath = config.get('Database.DownloadDirectory');
|
const hostedContentPath = config.get('Database.DownloadDirectory');
|
||||||
|
|
||||||
// configure logging
|
// configure logging
|
||||||
const logLevel = config.get('Logging.LogLevel');
|
const logLevel = config.get('Logging.LogLevel');
|
||||||
require('./config/loggerSetup.js')(winston, logLevel);
|
require('./config/loggerSetup.js')(logger, logLevel);
|
||||||
|
|
||||||
// set port
|
// set port
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
|
@ -29,7 +29,7 @@ app.use(bodyParser.json()); // for parsing application/json
|
||||||
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||||
app.use(siofu.router);
|
app.use(siofu.router);
|
||||||
app.use((req, res, next) => { // logging middleware
|
app.use((req, res, next) => { // logging middleware
|
||||||
winston.verbose(`Request on ${req.originalUrl} from ${req.ip}`);
|
logger.verbose(`Request on ${req.originalUrl} from ${req.ip}`);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ const hbs = expressHandlebars.create({
|
||||||
return options.inverse(this);
|
return options.inverse(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
firstCharacter (word) {
|
||||||
|
return word.substring(0, 1);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
app.engine('handlebars', hbs.engine);
|
app.engine('handlebars', hbs.engine);
|
||||||
|
@ -94,10 +97,10 @@ const server = require('./routes/sockets-routes.js')(app, siofu, hostedContentPa
|
||||||
db.sequelize.sync()
|
db.sequelize.sync()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
server.listen(PORT, () => {
|
server.listen(PORT, () => {
|
||||||
winston.info('Trusting proxy?', app.get('trust proxy'));
|
logger.info('Trusting proxy?', app.get('trust proxy'));
|
||||||
winston.info(`Server is listening on PORT ${PORT}`);
|
logger.info(`Server is listening on PORT ${PORT}`);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
winston.log('Error syncing sequelize db:', error);
|
logger.log('Error syncing sequelize db:', error);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,45 +4,45 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="panel links">
|
<div class="panel links">
|
||||||
<h2 class="subheader">Links</h2>
|
<h2 class="subheader">Links</h2>
|
||||||
{{!--direct link to asset--}}
|
{{!--short direct link to asset--}}
|
||||||
<a href="/{{fileInfo.name}}/{{fileInfo.claimId}}">Direct Link</a>
|
<div class="share-option">
|
||||||
|
<a href="/{{fileInfo.name}}/{{firstCharacter fileInfo.claimId}}">Direct Link</a>
|
||||||
<div class="input-error" id="input-error-copy-direct-link" hidden="true"></div>
|
<div class="input-error" id="input-error-copy-direct-link" hidden="true"></div>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="text" id="direct-link" class="link" readonly spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" onclick="select()"/>
|
<input type="text" id="direct-link" class="link" readonly spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{firstCharacter fileInfo.claimId}}" onclick="select()"/>
|
||||||
<button class="copy-button" data-elementtocopy="direct-link" onclick="copyToClipboard(event)">copy</button>
|
<button class="copy-button" data-elementtocopy="direct-link" onclick="copyToClipboard(event)">copy</button>
|
||||||
|
</div>
|
||||||
|
{{!-- link to show route for asset--}}
|
||||||
|
<div class="share-option">
|
||||||
|
<a href="/show/{{fileInfo.name}}/{{firstCharacter fileInfo.claimId}}">Details Link</a>
|
||||||
|
<div class="input-error" id="input-error-copy-show-link" hidden="true"></div>
|
||||||
|
</br>
|
||||||
|
<input type="text" id="show-link" class="link" readonly onclick="select()" spellcheck="false" value="https://spee.ch/show/{{fileInfo.name}}/{{firstCharacter fileInfo.claimId}}"/>
|
||||||
|
<button class="copy-button" data-elementtocopy="show-link" onclick="copyToClipboard(event)">copy</button>
|
||||||
|
</div>
|
||||||
|
{{!-- html text for embedding asset--}}
|
||||||
|
<div class="share-option">
|
||||||
|
Embed HTML
|
||||||
|
<div class="input-error" id="input-error-copy-embed-text" hidden="true"></div>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
||||||
|
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<video width="100%" controls><source src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" /></video>'/>
|
||||||
|
{{else}}
|
||||||
|
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<img src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" />'/>
|
||||||
|
{{/ifConditional}}
|
||||||
|
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
|
||||||
|
</div>
|
||||||
{{!--markdown text using asset--}}
|
{{!--markdown text using asset--}}
|
||||||
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
<div class="share-option">
|
||||||
Markdown
|
Markdown
|
||||||
<div class="input-error" id="input-error-copy-markdown-text" hidden="true"></div>
|
<div class="input-error" id="input-error-copy-markdown-text" hidden="true"></div>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="text" id="markdown-text" class="link" readonly onclick="select()" spellcheck="false" value='![{{fileInfo.name}}](https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}})'/>
|
<input type="text" id="markdown-text" class="link" readonly onclick="select()" spellcheck="false" value='![{{fileInfo.name}}](https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}})'/>
|
||||||
<button class="copy-button" data-elementtocopy="markdown-text" onclick="copyToClipboard(event)">copy</button>
|
<button class="copy-button" data-elementtocopy="markdown-text" onclick="copyToClipboard(event)">copy</button>
|
||||||
<br/>
|
</div>
|
||||||
<br/>
|
|
||||||
{{/ifConditional}}
|
{{/ifConditional}}
|
||||||
{{!-- html text for embedding asset--}}
|
|
||||||
Embed HTML
|
|
||||||
<div class="input-error" id="input-error-copy-embed-text" hidden="true"></div>
|
|
||||||
<br/>
|
|
||||||
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
|
||||||
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<video autoplay controls><source src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" /></video>'/>
|
|
||||||
{{else}}
|
|
||||||
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<img src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" />'/>
|
|
||||||
{{/ifConditional}}
|
|
||||||
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
{{!-- link to show route for asset--}}
|
|
||||||
<a href="/show/{{fileInfo.name}}/{{fileInfo.claimId}}">Details Link</a>
|
|
||||||
<div class="input-error" id="input-error-copy-show-link" hidden="true"></div>
|
|
||||||
</br>
|
|
||||||
<input type="text" id="show-link" class="link" readonly onclick="select()" spellcheck="false" value="https://spee.ch/show/{{fileInfo.name}}/{{fileInfo.claimId}}"/>
|
|
||||||
<button class="copy-button" data-elementtocopy="show-link" onclick="copyToClipboard(event)">copy</button>
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2 class="subheader">Metadata</h2>
|
<h2 class="subheader">Metadata</h2>
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type ="text/javascript">
|
<script type ="text/javascript">
|
||||||
|
|
||||||
function focusThisInput(event){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyToClipboard(event){
|
function copyToClipboard(event){
|
||||||
var elementToCopy = event.target.dataset.elementtocopy;
|
var elementToCopy = event.target.dataset.elementtocopy;
|
||||||
var element = document.getElementById(elementToCopy);
|
var element = document.getElementById(elementToCopy);
|
||||||
|
|
Loading…
Reference in a new issue