use SameSite=Lax instead of Strict so cookies aren't lost when opening links
This commit is contained in:
parent
cae85d9117
commit
a87470126a
5 changed files with 17 additions and 15 deletions
|
@ -2,12 +2,13 @@ const config = {
|
|||
WEBPACK_WEB_PORT: 9090,
|
||||
WEBPACK_ELECTRON_PORT: 9091,
|
||||
WEB_SERVER_PORT: 1337,
|
||||
DOMAIN: 'https://lbry.tv',
|
||||
DOMAIN: 'lbry.tv',
|
||||
URL: 'https://lbry.tv',
|
||||
SITE_TITLE: 'lbry.tv',
|
||||
LBRY_TV_API: 'https://api.lbry.tv',
|
||||
};
|
||||
|
||||
config.DOMAIN_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.DOMAIN_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -17,7 +17,7 @@ async function redirectMiddleware(ctx, next) {
|
|||
}
|
||||
|
||||
if (redirectHosts.includes(requestHost)) {
|
||||
const redirectUrl = config.DOMAIN + path;
|
||||
const redirectUrl = config.URL + path;
|
||||
ctx.redirect(redirectUrl);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { DOMAIN } = require('../../config.js');
|
||||
const { URL } = require('../../config.js');
|
||||
const { generateStreamUrl } = require('../../ui/util/lbrytv');
|
||||
const { getClaim } = require('./chainquery');
|
||||
const { parseURI } = require('lbry-redux');
|
||||
|
@ -9,13 +9,13 @@ let html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
|
|||
|
||||
const defaultHead =
|
||||
'<title>lbry.tv</title>\n' +
|
||||
`<meta property="og:url" content="${DOMAIN}" />\n` +
|
||||
`<meta property="og:url" content="${URL}" />\n` +
|
||||
'<meta property="og:title" content="lbry.tv" />\n' +
|
||||
'<meta property="og:site_name" content="lbry.tv | Content Freedom"/>\n' +
|
||||
'<meta property="og:description" content="Meet LBRY, an open, free, and community-controlled content wonderland." />\n' +
|
||||
`<meta property="og:image" content="${DOMAIN}/og.png" />\n` +
|
||||
`<meta property="og:image" content="${URL}/og.png" />\n` +
|
||||
'<meta name="twitter:card" content="summary_large_image"/>\n' +
|
||||
`<meta name="twitter:image" content="${DOMAIN}/og.png"/>\n` +
|
||||
`<meta name="twitter:image" content="${URL}/og.png"/>\n` +
|
||||
'<meta property="fb:app_id" content="1673146449633983" />';
|
||||
|
||||
function insertToHead(fullHtml, htmlToInsert = defaultHead) {
|
||||
|
@ -45,7 +45,7 @@ function buildOgMetadata(uri, claim) {
|
|||
? escapeHtmlProperty(truncateDescription(claim.description))
|
||||
: `Watch ${title} on LBRY.tv`;
|
||||
const claimLanguage = escapeHtmlProperty(claim.language) || 'en_US';
|
||||
const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || `${DOMAIN}/og.png`;
|
||||
const claimThumbnail = escapeHtmlProperty(claim.thumbnail_url) || `${URL}/og.png`;
|
||||
const claimTitle = claim.channel && !isChannel ? `${title} from ${claim.channel} on LBRY.tv` : `${title} on LBRY.tv`;
|
||||
|
||||
let head = '';
|
||||
|
@ -65,7 +65,7 @@ function buildOgMetadata(uri, claim) {
|
|||
head += `<meta property="og:type" content="website"/>`;
|
||||
head += `<meta property="og:title" content="${claimTitle}"/>`;
|
||||
// below should be canonical_url, but not provided by chainquery yet
|
||||
head += `<meta property="og:url" content="${DOMAIN}/${claim.name}:${claim.claim_id}"/>`;
|
||||
head += `<meta property="og:url" content="${URL}/${claim.name}:${claim.claim_id}"/>`;
|
||||
|
||||
if (claim.source_media_type && claim.source_media_type.startsWith('video/')) {
|
||||
const videoUrl = generateStreamUrl(claim.name, claim.claim_id);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @flow
|
||||
import { DOMAIN, DOMAIN_LOCAL, DOMAIN_DEV } from 'config';
|
||||
import { URL, URL_LOCAL, URL_DEV } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
|
@ -12,9 +12,9 @@ import Tag from 'component/tag';
|
|||
|
||||
const L_KEY_CODE = 76;
|
||||
const ESC_KEY_CODE = 27;
|
||||
const WEB_DEV_PREFIX = `${DOMAIN_DEV}/`;
|
||||
const WEB_LOCAL_PREFIX = `${DOMAIN_LOCAL}/`;
|
||||
const WEB_PROD_PREFIX = `${DOMAIN}/`;
|
||||
const WEB_DEV_PREFIX = `${URL_DEV}/`;
|
||||
const WEB_LOCAL_PREFIX = `${URL_LOCAL}/`;
|
||||
const WEB_PROD_PREFIX = `${URL}/`;
|
||||
const SEARCH_PREFIX = `$/${PAGES.SEARCH}q=`;
|
||||
|
||||
type Props = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { DOMAIN } from 'config';
|
||||
|
||||
let sessionPassword;
|
||||
|
||||
|
@ -11,7 +12,7 @@ function setCookie(name: string, value: string, days: number) {
|
|||
expires = '; expires=' + date.toUTCString();
|
||||
}
|
||||
|
||||
document.cookie = `${name}=${value || ''}${expires}; path=/;samesite=strict;`;
|
||||
document.cookie = `${name}=${value || ''}${expires}; domain=.${DOMAIN}; path=/; SameSite=Lax; Secure;`;
|
||||
}
|
||||
|
||||
function getCookie(name: string) {
|
||||
|
|
Loading…
Add table
Reference in a new issue