Quick-fix, filter views with UA containing LBRY (for thumbs)
This commit is contained in:
parent
d625d9b76a
commit
828e8dce70
4 changed files with 13 additions and 11 deletions
|
@ -11,7 +11,7 @@ const serveAsset = ({ headers, ip, originalUrl, params: { claimName, claimId } }
|
||||||
// send google analytics
|
// send google analytics
|
||||||
sendGAServeEvent(headers, ip, originalUrl);
|
sendGAServeEvent(headers, ip, originalUrl);
|
||||||
// get the claim Id and then serve the asset
|
// get the claim Id and then serve the asset
|
||||||
getClaimIdAndServeAsset(null, null, claimName, claimId, originalUrl, ip, res);
|
getClaimIdAndServeAsset(null, null, claimName, claimId, originalUrl, ip, res, headers);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = serveAsset;
|
module.exports = serveAsset;
|
||||||
|
|
|
@ -37,7 +37,7 @@ const serveByClaim = (req, res) => {
|
||||||
({ claimName } = lbryUri.parseClaim(params.claim));
|
({ claimName } = lbryUri.parseClaim(params.claim));
|
||||||
logger.debug('serve request:', { headers, ip, originalUrl, params });
|
logger.debug('serve request:', { headers, ip, originalUrl, params });
|
||||||
|
|
||||||
getClaimIdAndServeAsset(null, null, claimName, null, originalUrl, ip, res);
|
getClaimIdAndServeAsset(null, null, claimName, null, originalUrl, ip, res, headers);
|
||||||
|
|
||||||
sendGAServeEvent(headers, ip, originalUrl);
|
sendGAServeEvent(headers, ip, originalUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ const serverByIdentifierAndClaim = (req, res) => {
|
||||||
claimId,
|
claimId,
|
||||||
});
|
});
|
||||||
|
|
||||||
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res);
|
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res, headers);
|
||||||
|
|
||||||
sendGAServeEvent(headers, ip, originalUrl);
|
sendGAServeEvent(headers, ip, originalUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ const CONTENT_UNAVAILABLE = 'CONTENT_UNAVAILABLE';
|
||||||
|
|
||||||
const { publishing: { serveOnlyApproved, approvedChannels } } = require('@config/siteConfig');
|
const { publishing: { serveOnlyApproved, approvedChannels } } = require('@config/siteConfig');
|
||||||
|
|
||||||
const getClaimIdAndServeAsset = (channelName, channelClaimId, claimName, claimId, originalUrl, ip, res) => {
|
const getClaimIdAndServeAsset = (channelName, channelClaimId, claimName, claimId, originalUrl, ip, res, headers) => {
|
||||||
getClaimId(channelName, channelClaimId, claimName, claimId)
|
getClaimId(channelName, channelClaimId, claimName, claimId)
|
||||||
.then(fullClaimId => {
|
.then(fullClaimId => {
|
||||||
claimId = fullClaimId;
|
claimId = fullClaimId;
|
||||||
|
@ -47,13 +47,15 @@ const getClaimIdAndServeAsset = (channelName, channelClaimId, claimName, claimId
|
||||||
logger.debug('Outpoint:', outpoint);
|
logger.debug('Outpoint:', outpoint);
|
||||||
return db.Blocked.isNotBlocked(outpoint).then(() => {
|
return db.Blocked.isNotBlocked(outpoint).then(() => {
|
||||||
// If content was found, is approved, and not blocked - log a view.
|
// If content was found, is approved, and not blocked - log a view.
|
||||||
db.Views.create({
|
if(headers && headers['user-agent'] && /LBRY/.test(headers['user-agent']) === false) {
|
||||||
time: Date.now(),
|
db.Views.create({
|
||||||
isChannel: false,
|
time: Date.now(),
|
||||||
claimId: claimDataValues.claim_id || claimDataValues.claimId,
|
isChannel: false,
|
||||||
publisherId: claimDataValues.publisher_id || claimDataValues.certificateId,
|
claimId: claimDataValues.claim_id || claimDataValues.claimId,
|
||||||
ip,
|
publisherId: claimDataValues.publisher_id || claimDataValues.certificateId,
|
||||||
});
|
ip,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue