diff --git a/.eslintrc.json b/.eslintrc.json index 42c7b586..81257cb3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,10 +21,6 @@ "@typescript-eslint/explicit-module-boundary-types": 0, "@typescript-eslint/no-empty-function": 0, "arrow-body-style": 0, - "jsx-a11y/anchor-is-valid": 1, - "jsx-a11y/aria-role": 1, - "jsx-a11y/click-events-have-key-events": 1, - "jsx-a11y/no-static-element-interactions": 1, "curly": 0, "eol-last": 0, "eqeqeq": 0, diff --git a/src/assets/css/main.css b/src/assets/css/main.css index dde2a503..d3e9d0b8 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -84,7 +84,7 @@ margin-top: -6.5px; } -.post-title a:visited { +.post-title a:visited:not(:hover) { color: var(--bs-gray) !important; } diff --git a/src/server/handlers/theme-handler.ts b/src/server/handlers/theme-handler.ts index b107d854..456fb3bd 100644 --- a/src/server/handlers/theme-handler.ts +++ b/src/server/handlers/theme-handler.ts @@ -11,22 +11,21 @@ export default async (req: Request, res: Response) => { const theme = req.params.name; if (!theme.endsWith(".css")) { - res.statusCode = 400; - res.send("Theme must be a css file"); + return res.status(400).send("Theme must be a css file"); } const customTheme = path.resolve(extraThemesFolder, theme); if (existsSync(customTheme)) { - res.sendFile(customTheme); + return res.sendFile(customTheme); } else { const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`); // If the theme doesn't exist, just send litely if (existsSync(internalTheme)) { - res.sendFile(internalTheme); + return res.sendFile(internalTheme); } else { - res.sendFile(path.resolve("./dist/assets/css/themes/litely.css")); + return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css")); } } }; diff --git a/src/server/middleware/set-default-csp.ts b/src/server/middleware/set-default-csp.ts index a3ee5261..fd776ab6 100644 --- a/src/server/middleware/set-default-csp.ts +++ b/src/server/middleware/set-default-csp.ts @@ -3,7 +3,7 @@ import type { NextFunction, Response } from "express"; export default function ({ res, next }: { res: Response; next: NextFunction }) { res.setHeader( "Content-Security-Policy", - `default-src 'self'; manifest-src *; connect-src *; img-src * data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; form-action 'self'; base-uri 'self'; frame-src *; media-src *` + `default-src 'self'; manifest-src *; connect-src *; img-src * data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; form-action 'self'; base-uri 'self'; frame-src *; media-src * data:` ); next(); diff --git a/src/shared/components/post/metadata-card.tsx b/src/shared/components/post/metadata-card.tsx index 2d770d44..a1ddca7f 100644 --- a/src/shared/components/post/metadata-card.tsx +++ b/src/shared/components/post/metadata-card.tsx @@ -1,8 +1,7 @@ -import { Component, linkEvent } from "inferno"; +import { Component } from "inferno"; import { Post } from "lemmy-js-client"; import * as sanitizeHtml from "sanitize-html"; import { relTags } from "../../config"; -import { I18NextService } from "../../services"; import { Icon } from "../common/icon"; interface MetadataCardProps { @@ -17,10 +16,6 @@ export class MetadataCard extends Component< MetadataCardProps, MetadataCardState > { - state: MetadataCardState = { - expanded: false, - }; - constructor(props: any, context: any) { super(props, context); } @@ -29,7 +24,7 @@ export class MetadataCard extends Component< const post = this.props.post; return ( <> - {!this.state.expanded && post.embed_title && post.url && ( + {post.embed_title && post.url && (
@@ -61,34 +56,12 @@ export class MetadataCard extends Component< }} /> )} - {post.embed_video_url && ( - - )}
)} - {this.state.expanded && post.embed_video_url && ( -
- -
- )} ); } - - handleIframeExpand(i: MetadataCard) { - i.setState({ expanded: !i.state.expanded }); - } } diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index e5694fa7..ac90b0d8 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -262,6 +262,7 @@ export class PostListing extends Component { const { post } = this.postView; const { url } = post; + // if direct video link if (url && isVideo(url)) { return (
@@ -272,6 +273,20 @@ export class PostListing extends Component { ); } + // if embedded video link + if (url && post.embed_video_url) { + return ( +
+ +
+ ); + } + return <>; } @@ -338,7 +353,7 @@ export class PostListing extends Component { ); } else if (url) { - if (!this.props.hideImage && isVideo(url)) { + if ((!this.props.hideImage && isVideo(url)) || post.embed_video_url) { return ( { const post_view = this.postView; return ( - + {this.creatorIsMod_ && ( {I18NextService.i18n.t("mod")} @@ -429,8 +444,8 @@ export class PostListing extends Component { { { const url = post.url; return ( -

+

{url && !(hostname(url) === getExternalHost()) && ( { {post_view.counts.comments} {this.unreadCount && ( - - ({this.unreadCount} {I18NextService.i18n.t("new")}) - + <> + {" "} + + ({this.unreadCount} {I18NextService.i18n.t("new")}) + + )} ); diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 473b18c4..b58580e5 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -332,7 +332,9 @@ export class Search extends Component { } async componentDidMount() { - if (!this.state.isIsomorphic) { + if ( + !(this.state.isIsomorphic || this.props.history.location.state?.searched) + ) { const promises = [this.fetchCommunities()]; if (this.state.searchText) { promises.push(this.search()); @@ -1095,7 +1097,9 @@ export class Search extends Component { sort: sort ?? urlSort, }; - this.props.history.push(`/search${getQueryString(queryParams)}`); + this.props.history.push(`/search${getQueryString(queryParams)}`, { + searched: true, + }); await this.search(); }