mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 08:47:19 +00:00
Swapping out iframely.
This commit is contained in:
parent
62e410c382
commit
2943e6e1a5
|
@ -69,7 +69,7 @@
|
|||
"husky": "^7.0.1",
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"iso-639-1": "^2.1.9",
|
||||
"lemmy-js-client": "0.11.4-rc.10",
|
||||
"lemmy-js-client": "0.11.4-rc.12",
|
||||
"lint-staged": "^11.0.1",
|
||||
"mini-css-extract-plugin": "^2.1.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
communityToChoice,
|
||||
debounce,
|
||||
fetchCommunities,
|
||||
getPageTitle,
|
||||
getSiteMetadata,
|
||||
isBrowser,
|
||||
isImage,
|
||||
pictrsDeleteToast,
|
||||
|
@ -414,8 +414,8 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
WebSocketService.Instance.send(wsClient.search(form));
|
||||
|
||||
// Fetch the page title
|
||||
getPageTitle(this.state.postForm.url).then(d => {
|
||||
this.state.suggestedTitle = d;
|
||||
getSiteMetadata(this.state.postForm.url).then(d => {
|
||||
this.state.suggestedTitle = d.metadata.title;
|
||||
this.setState(this.state);
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -2,6 +2,7 @@ import emojiShortName from "emoji-short-name";
|
|||
import {
|
||||
CommentView,
|
||||
CommunityView,
|
||||
GetSiteMetadata,
|
||||
GetSiteResponse,
|
||||
LemmyHttp,
|
||||
LemmyWebsocket,
|
||||
|
@ -328,10 +329,12 @@ export function routeSearchTypeToEnum(type: string): SearchType {
|
|||
return SearchType[type];
|
||||
}
|
||||
|
||||
export async function getPageTitle(url: string) {
|
||||
let res = await fetch(`/iframely/oembed?url=${url}`).then(res => res.json());
|
||||
let title = await res.title;
|
||||
return title;
|
||||
export async function getSiteMetadata(url: string) {
|
||||
let form: GetSiteMetadata = {
|
||||
url,
|
||||
};
|
||||
let client = new LemmyHttp(httpBase);
|
||||
return client.getSiteMetadata(form);
|
||||
}
|
||||
|
||||
export function debounce(func: any, wait = 1000, immediate = false) {
|
||||
|
|
Loading…
Reference in a new issue