fix (backend): host and hostname was messed up

This commit is contained in:
naskya 2024-04-20 08:48:48 +09:00
parent d41b462a89
commit f33c7c6c94
No known key found for this signature in database
GPG Key ID: 712D413B3A9FED5C
4 changed files with 9 additions and 9 deletions

View File

@ -296,14 +296,14 @@ fn load_config() -> Config {
let version = read_meta().version;
let manifest = read_manifest();
let url = url::Url::parse(&server_config.url).expect("Config url is invalid");
let host = url
let hostname = url
.host_str()
.expect("Hostname is missing in the config url")
.to_owned();
let hostname = url
.domain()
.expect("Domain is missing in the config url")
.to_owned();
let host = match url.port() {
Some(port) => format!("{}:{}", hostname, port),
None => hostname.clone(),
};
let scheme = url.scheme().to_owned();
let ws_scheme = scheme.replace("http", "ws");
@ -320,7 +320,7 @@ fn load_config() -> Config {
} else {
server_config.redis.prefix.clone()
}
.unwrap_or(hostname.clone());
.unwrap_or(host.clone());
Config {
url: server_config.url,

View File

@ -22,7 +22,7 @@ export default class extends Channel {
this.listId = params.listId as string;
// Check existence and owner
const exist = await UserLists.exist({
const exist = await UserLists.exists({
where: {
id: this.listId,
userId: this.user!.id,

View File

@ -1,4 +1,4 @@
import type { EventEmitter } from "events";
import type { EventEmitter } from "node:events";
import type * as websocket from "websocket";
import readNote from "@/services/note/read.js";
import type { User } from "@/models/entities/user.js";

View File

@ -1,4 +1,4 @@
import type { EventEmitter } from "events";
import type { EventEmitter } from "node:events";
import type Emitter from "strict-event-emitter-types";
import type { Channel } from "@/models/entities/channel.js";
import type { User } from "@/models/entities/user.js";