Merge branch 'main' into new-comment-space
This commit is contained in:
commit
fe1124ef7d
2 changed files with 10 additions and 7 deletions
|
@ -11,22 +11,21 @@ export default async (req: Request, res: Response) => {
|
||||||
const theme = req.params.name;
|
const theme = req.params.name;
|
||||||
|
|
||||||
if (!theme.endsWith(".css")) {
|
if (!theme.endsWith(".css")) {
|
||||||
res.statusCode = 400;
|
return res.status(400).send("Theme must be a css file");
|
||||||
res.send("Theme must be a css file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const customTheme = path.resolve(extraThemesFolder, theme);
|
const customTheme = path.resolve(extraThemesFolder, theme);
|
||||||
|
|
||||||
if (existsSync(customTheme)) {
|
if (existsSync(customTheme)) {
|
||||||
res.sendFile(customTheme);
|
return res.sendFile(customTheme);
|
||||||
} else {
|
} else {
|
||||||
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
|
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
|
||||||
|
|
||||||
// If the theme doesn't exist, just send litely
|
// If the theme doesn't exist, just send litely
|
||||||
if (existsSync(internalTheme)) {
|
if (existsSync(internalTheme)) {
|
||||||
res.sendFile(internalTheme);
|
return res.sendFile(internalTheme);
|
||||||
} else {
|
} else {
|
||||||
res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
|
return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -332,7 +332,9 @@ export class Search extends Component<any, SearchState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
if (!this.state.isIsomorphic) {
|
if (
|
||||||
|
!(this.state.isIsomorphic || this.props.history.location.state?.searched)
|
||||||
|
) {
|
||||||
const promises = [this.fetchCommunities()];
|
const promises = [this.fetchCommunities()];
|
||||||
if (this.state.searchText) {
|
if (this.state.searchText) {
|
||||||
promises.push(this.search());
|
promises.push(this.search());
|
||||||
|
@ -1095,7 +1097,9 @@ export class Search extends Component<any, SearchState> {
|
||||||
sort: sort ?? urlSort,
|
sort: sort ?? urlSort,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.props.history.push(`/search${getQueryString(queryParams)}`);
|
this.props.history.push(`/search${getQueryString(queryParams)}`, {
|
||||||
|
searched: true,
|
||||||
|
});
|
||||||
|
|
||||||
await this.search();
|
await this.search();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue