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);
|
||||
// 3. if a match was not found use the daemon to retrieve the claim & return the db data once it is created
|
||||
} else {
|
||||
logger.debug('No result found in File table,');
|
||||
logger.debug('No result found in File table');
|
||||
lbryApi
|
||||
.resolveUri(uri)
|
||||
.then(result => {
|
||||
|
|
15
server.js
15
server.js
|
@ -5,13 +5,13 @@ const siofu = require('socketio-file-upload');
|
|||
const expressHandlebars = require('express-handlebars');
|
||||
const Handlebars = require('handlebars');
|
||||
const config = require('config');
|
||||
const winston = require('winston');
|
||||
const logger = require('winston');
|
||||
|
||||
const hostedContentPath = config.get('Database.DownloadDirectory');
|
||||
|
||||
// configure logging
|
||||
const logLevel = config.get('Logging.LogLevel');
|
||||
require('./config/loggerSetup.js')(winston, logLevel);
|
||||
require('./config/loggerSetup.js')(logger, logLevel);
|
||||
|
||||
// set port
|
||||
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(siofu.router);
|
||||
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();
|
||||
});
|
||||
|
||||
|
@ -74,6 +74,9 @@ const hbs = expressHandlebars.create({
|
|||
return options.inverse(this);
|
||||
}
|
||||
},
|
||||
firstCharacter (word) {
|
||||
return word.substring(0, 1);
|
||||
},
|
||||
},
|
||||
});
|
||||
app.engine('handlebars', hbs.engine);
|
||||
|
@ -94,10 +97,10 @@ const server = require('./routes/sockets-routes.js')(app, siofu, hostedContentPa
|
|||
db.sequelize.sync()
|
||||
.then(() => {
|
||||
server.listen(PORT, () => {
|
||||
winston.info('Trusting proxy?', app.get('trust proxy'));
|
||||
winston.info(`Server is listening on PORT ${PORT}`);
|
||||
logger.info('Trusting proxy?', app.get('trust proxy'));
|
||||
logger.info(`Server is listening on PORT ${PORT}`);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
winston.log('Error syncing sequelize db:', error);
|
||||
logger.log('Error syncing sequelize db:', error);
|
||||
});
|
||||
|
|
|
@ -4,45 +4,45 @@
|
|||
</div>
|
||||
<div class="panel links">
|
||||
<h2 class="subheader">Links</h2>
|
||||
{{!--direct link to asset--}}
|
||||
<a href="/{{fileInfo.name}}/{{fileInfo.claimId}}">Direct Link</a>
|
||||
<div class="input-error" id="input-error-copy-direct-link" hidden="true"></div>
|
||||
<br/>
|
||||
<input type="text" id="direct-link" class="link" readonly spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" onclick="select()"/>
|
||||
<button class="copy-button" data-elementtocopy="direct-link" onclick="copyToClipboard(event)">copy</button>
|
||||
<br/>
|
||||
<br/>
|
||||
{{!--short direct link to asset--}}
|
||||
<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>
|
||||
<br/>
|
||||
<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>
|
||||
</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/>
|
||||
{{#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--}}
|
||||
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
||||
{{else}}
|
||||
<div class="share-option">
|
||||
Markdown
|
||||
<div class="input-error" id="input-error-copy-markdown-text" hidden="true"></div>
|
||||
<br/>
|
||||
<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>
|
||||
<br/>
|
||||
<br/>
|
||||
</div>
|
||||
{{/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 class="panel">
|
||||
<h2 class="subheader">Metadata</h2>
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
</div>
|
||||
|
||||
<script type ="text/javascript">
|
||||
|
||||
function focusThisInput(event){
|
||||
|
||||
}
|
||||
|
||||
function copyToClipboard(event){
|
||||
var elementToCopy = event.target.dataset.elementtocopy;
|
||||
var element = document.getElementById(elementToCopy);
|
||||
|
|
Loading…
Reference in a new issue