mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 07:36:37 +00:00
Fixing RSS for non-local communities. Fixes #53
This commit is contained in:
parent
ecb54ed43d
commit
7cb650dbd3
|
@ -52,6 +52,7 @@ import {
|
||||||
isBrowser,
|
isBrowser,
|
||||||
lemmyHttp,
|
lemmyHttp,
|
||||||
setAuth,
|
setAuth,
|
||||||
|
communityRSSUrl,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
|
||||||
|
@ -320,7 +321,10 @@ export class Community extends Component<any, State> {
|
||||||
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
|
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
href={`/feeds/c/${this.state.communityName}.xml?sort=${this.state.sort}`}
|
href={communityRSSUrl(
|
||||||
|
this.state.communityRes.community.actor_id,
|
||||||
|
this.state.sort
|
||||||
|
)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
title="RSS"
|
title="RSS"
|
||||||
rel="noopener"
|
rel="noopener"
|
||||||
|
|
|
@ -278,6 +278,11 @@ export function validURL(str: string) {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function communityRSSUrl(actorId: string, sort: string): string {
|
||||||
|
let url = new URL(actorId);
|
||||||
|
return `${url.origin}/feeds${url.pathname}.xml?sort=${sort}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function validEmail(email: string) {
|
export function validEmail(email: string) {
|
||||||
let re = /^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z\-]+\.)+[A-Za-z]{2,}))$/;
|
let re = /^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z\-]+\.)+[A-Za-z]{2,}))$/;
|
||||||
return re.test(String(email).toLowerCase());
|
return re.test(String(email).toLowerCase());
|
||||||
|
|
Loading…
Reference in a new issue