465 social share with extensions #492
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
Osprey
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
resilience
Tom's Wishlist
type: bug
type: discussion
type: error handling
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/spee.ch#492
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "465-social-share-with-extensions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
adds open graph support for image urls with the file type suffix. e.g. spee.ch/a/example.jpg
Will the route changing affect previously shared URLs?
@ -0,0 +1,54 @@
const logger = require('winston');
const { EMBED, BROWSER, SOCIAL } = require('../constants/request_types.js');
function headersMatchesSocialBotList (headers) {
This could be simplified by using an object instead of an array
@ -0,0 +1,54 @@
const logger = require('winston');
const { EMBED, BROWSER, SOCIAL } = require('../constants/request_types.js');
function headersMatchesSocialBotList (headers) {
cool pattern. I updated to use this.
@seanyesmunt previous URLs should not be negatively affected. This adds a new route, but does not remove the existing routes. The new route will be used only for the image sources for SEO tags, so it is specifically for serving images for SEO.
@ -0,0 +32,4 @@
return SOCIAL;
}
// if request is not from a social bot...
if (hasFileExtension) {
Multiple return statements in a function can be a contentious topic (e.g. https://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement), but I think a function like this is better if the returns are just inlined, rather than setting a variable.
@ -0,0 +1,54 @@
const logger = require('winston');
const { EMBED, BROWSER, SOCIAL } = require('../constants/request_types.js');
function headersMatchesSocialBotList (headers) {
@seanyesmunt do you prefer that to just:
@ -0,0 +1,54 @@
const logger = require('winston');
const { EMBED, BROWSER, SOCIAL } = require('../constants/request_types.js');
function headersMatchesSocialBotList (headers) {
(technically
includes
is presumablyO(n)
and a map lookupO(1)
, but this is such an efficient operation that this doesn't matter)