diff --git a/src/platforms/web/server.js b/src/platforms/web/server.js index 9d9a3dcf5..6f8819d84 100644 --- a/src/platforms/web/server.js +++ b/src/platforms/web/server.js @@ -1,10 +1,10 @@ const { parseURI } = require('lbry-redux'); +const { generateStreamUrl } = require('../../src/ui/util/lbrytv'); const { WEB_SERVER_PORT } = require('../../config'); const { readFileSync } = require('fs'); const express = require('express'); const path = require('path'); const app = express(); - const mysql = require('mysql'); const pool = mysql.createPool({ @@ -15,11 +15,11 @@ const pool = mysql.createPool({ database: 'chainquery', }); -const getClaim = (claimName, claimId, callback) => { +const getClaim = (claimName, claimId, channelName, channelClaimId, callback) => { let params = [claimName]; let sql = - 'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title ' + + 'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height ' + 'FROM claim ' + 'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' + 'WHERE claim.name = ?'; @@ -31,6 +31,17 @@ const getClaim = (claimName, claimId, callback) => { sql += ' AND claim.bid_state = "controlling"'; } + if (claimName[0] !== '@' && channelName) { + sql += ' AND channel_claim.name = ?'; + params.push('@' + channelName); + if (channelClaimId) { + sql += ' AND channel_claim.claim_id LIKE ?'; + params.push(channelClaimId + '%'); + } else { + sql += ' AND channel_claim.bid_state = "controlling"'; + } + } + sql += ' LIMIT 1'; pool.query(sql, params, callback); @@ -43,7 +54,7 @@ function truncateDescription(description) { } function insertToHead(fullHtml, htmlToInsert) { - return fullHtml.replace('%%HEAD_TOKEN%%', htmlToInsert); + return fullHtml.replace('', htmlToInsert); } const defaultHead = @@ -67,7 +78,7 @@ app.get('*', async (req, res) => { const claimName = isChannel ? '@' + channelName : streamName; const claimId = isChannel ? channelClaimId : streamClaimId; - getClaim(claimName, claimId, (err, rows) => { + getClaim(claimName, claimId, channelName, channelClaimId, (err, rows) => { if (!err && rows && rows.length > 0) { const claim = rows[0]; const title = claim.title ? claim.title : claimName; @@ -83,6 +94,7 @@ app.get('*', async (req, res) => { let head = ''; head += ''; + head += `${claimTitle}`; head += ``; if (claim.tags) { head += ``; @@ -95,7 +107,17 @@ app.get('*', async (req, res) => { head += ``; // below should be canonical_url, but not provided by chainquery yet head += ``; - head += `${claimTitle}`; + + if (claim.source_media_type && claim.source_media_type.startsWith('video/')) { + const videoUrl = generateStreamUrl(claim.name, claim.claim_id); + head += ``; + head += ``; + head += ``; + if (claim.frame_width && claim.frame_height) { + head += ` - %%HEAD_TOKEN%% + diff --git a/static/locales/pl.json b/static/locales/pl.json index cb24686c9..58180c411 100644 --- a/static/locales/pl.json +++ b/static/locales/pl.json @@ -608,5 +608,20 @@ "Unlock": "Odblokuj", "Exit": "Wyjście", "Wallet Password": "Hasło portfela", - "Unlock Wallet": "Odblokuj portfel" -} + "Unlock Wallet": "Odblokuj portfel", + "URI does not include name.": "URI does not include name.", + "You're not following any channels.": "You're not following any channels.", + "Look what's trending for everyone": "Look what's trending for everyone", + "or": "or", + "Discover some channels!": "Discover some channels!", + "Block": "Block", + "This file is in your library.": "This file is in your library.", + "Send a tip to this creator": "Send a tip to this creator", + "File Size": "File Size", + "Loading": "Loading", + "LBRY Download Complete": "LBRY Download Complete", + "Find New Tags": "Find New Tags", + "View File": "View File", + "Close": "Close", + "% downloaded": "% downloaded" +} \ No newline at end of file