isBrowser,
lemmyHttp,
setAuth,
+ communityRSSUrl,
} from '../utils';
import { i18n } from '../i18next';
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
</span>
<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"
title="RSS"
rel="noopener"
// }
}
+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) {
let re = /^(([^\s"(),.:;<>@[\\\]]+(\.[^\s"(),.:;<>@[\\\]]+)*)|(".+"))@((\[(?:\d{1,3}\.){3}\d{1,3}])|(([\dA-Za-z\-]+\.)+[A-Za-z]{2,}))$/;
return re.test(String(email).toLowerCase());