added file extensions to the share links
This commit is contained in:
parent
b0f43189a3
commit
89ae795b22
|
@ -28,6 +28,7 @@ module.exports = {
|
||||||
// 3. if a matching record is found locally, serve it
|
// 3. if a matching record is found locally, serve it
|
||||||
if (result) {
|
if (result) {
|
||||||
// return the data for the file to be served
|
// return the data for the file to be served
|
||||||
|
result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.'));
|
||||||
serveHelpers.getShortUrlByClaimId(name, claimId)
|
serveHelpers.getShortUrlByClaimId(name, claimId)
|
||||||
.then(shortUrl => {
|
.then(shortUrl => {
|
||||||
result.dataValues['shortUrl'] = shortUrl;
|
result.dataValues['shortUrl'] = shortUrl;
|
||||||
|
@ -64,6 +65,7 @@ module.exports = {
|
||||||
if (result) {
|
if (result) {
|
||||||
logger.debug('local result found');
|
logger.debug('local result found');
|
||||||
// return the data for the file to be served
|
// return the data for the file to be served
|
||||||
|
result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.'));
|
||||||
serveHelpers.getShortUrlByClaimId(name, claimId)
|
serveHelpers.getShortUrlByClaimId(name, claimId)
|
||||||
.then(shortUrl => {
|
.then(shortUrl => {
|
||||||
result.dataValues['shortUrl'] = shortUrl;
|
result.dataValues['shortUrl'] = shortUrl;
|
||||||
|
@ -123,6 +125,7 @@ module.exports = {
|
||||||
// 3. if a match is found locally, serve that claim
|
// 3. if a match is found locally, serve that claim
|
||||||
if (result) {
|
if (result) {
|
||||||
// return the data for the file to be served
|
// return the data for the file to be served
|
||||||
|
result.dataValues['fileExt'] = result.fileName.substring(result.fileName.lastIndexOf('.'));
|
||||||
result.dataValues['shortUrl'] = shortUrl;
|
result.dataValues['shortUrl'] = shortUrl;
|
||||||
resolve(result.dataValues);
|
resolve(result.dataValues);
|
||||||
// update the file, as needed
|
// update the file, as needed
|
||||||
|
|
|
@ -141,7 +141,7 @@ module.exports = (app) => {
|
||||||
} else if (dotIndex === -1) {
|
} else if (dotIndex === -1) {
|
||||||
// google analytics
|
// google analytics
|
||||||
sendGoogleAnalytics('show', headers, ip, originalUrl);
|
sendGoogleAnalytics('show', headers, ip, originalUrl);
|
||||||
// get and render the content
|
// begin image-show process
|
||||||
showClaimByName(params.name)
|
showClaimByName(params.name)
|
||||||
.then(fileInfo => {
|
.then(fileInfo => {
|
||||||
// check to make sure a file was found
|
// check to make sure a file was found
|
||||||
|
|
|
@ -6,20 +6,20 @@
|
||||||
<h2 class="subheader">Links</h2>
|
<h2 class="subheader">Links</h2>
|
||||||
{{!--short direct link to asset--}}
|
{{!--short direct link to asset--}}
|
||||||
<div class="share-option">
|
<div class="share-option">
|
||||||
<a href="/{{fileInfo.name}}/{{fileInfo.shortUrl}}">Permanent Short Link</a>
|
<a href="/{{fileInfo.name}}/{{fileInfo.shortUrl}}{{fileInfo.fileExt}}">Permanent Short Link</a>
|
||||||
(most convenient)
|
(most convenient)
|
||||||
<div class="input-error" id="input-error-copy-short-link" hidden="true"></div>
|
<div class="input-error" id="input-error-copy-short-link" hidden="true"></div>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="text" id="short-link" class="link" readonly spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.shortUrl}}" onclick="select()"/>
|
<input type="text" id="short-link" class="link" readonly spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.shortUrl}}{{fileInfo.fileExt}}" onclick="select()"/>
|
||||||
<button class="copy-button" data-elementtocopy="short-link" onclick="copyToClipboard(event)">copy</button>
|
<button class="copy-button" data-elementtocopy="short-link" onclick="copyToClipboard(event)">copy</button>
|
||||||
</div>
|
</div>
|
||||||
{{!-- link to show route for asset--}}
|
{{!-- link to show route for asset--}}
|
||||||
<div class="share-option">
|
<div class="share-option">
|
||||||
<a href="/{{fileInfo.name}}/{{fileInfo.claimId}}">Permanent Long Link</a>
|
<a href="/{{fileInfo.name}}/{{fileInfo.claimId}}{{fileInfo.fileExt}}">Permanent Long Link</a>
|
||||||
(fastest service)
|
(fastest service)
|
||||||
<div class="input-error" id="input-error-copy-long-link" hidden="true"></div>
|
<div class="input-error" id="input-error-copy-long-link" hidden="true"></div>
|
||||||
</br>
|
</br>
|
||||||
<input type="text" id="long-link" class="link" readonly onclick="select()" spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}"/>
|
<input type="text" id="long-link" class="link" readonly onclick="select()" spellcheck="false" value="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}{{fileInfo.fileExt}}"/>
|
||||||
<button class="copy-button" data-elementtocopy="long-link" onclick="copyToClipboard(event)">copy</button>
|
<button class="copy-button" data-elementtocopy="long-link" onclick="copyToClipboard(event)">copy</button>
|
||||||
</div>
|
</div>
|
||||||
{{!-- html text for embedding asset--}}
|
{{!-- html text for embedding asset--}}
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
<div class="input-error" id="input-error-copy-embed-text" hidden="true"></div>
|
<div class="input-error" id="input-error-copy-embed-text" hidden="true"></div>
|
||||||
<br/>
|
<br/>
|
||||||
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
|
{{#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>'/>
|
<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}}{{fileInfo.fileExt}}" /></video>'/>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<img src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}" />'/>
|
<input type="text" id="embed-text" class="link" readonly onclick="select()" spellcheck="false" value='<img src="https://spee.ch/{{fileInfo.name}}/{{fileInfo.claimId}}{{fileInfo.fileExt}}" />'/>
|
||||||
{{/ifConditional}}
|
{{/ifConditional}}
|
||||||
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
|
<button class="copy-button" data-elementtocopy="embed-text" onclick="copyToClipboard(event)">copy</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
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}}{{fileInfo.fileExt}})'/>
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
{{/ifConditional}}
|
{{/ifConditional}}
|
||||||
|
|
Loading…
Reference in a new issue