fix (backend): host and hostname was messed up
This commit is contained in:
parent
d41b462a89
commit
f33c7c6c94
|
@ -296,14 +296,14 @@ fn load_config() -> Config {
|
||||||
let version = read_meta().version;
|
let version = read_meta().version;
|
||||||
let manifest = read_manifest();
|
let manifest = read_manifest();
|
||||||
let url = url::Url::parse(&server_config.url).expect("Config url is invalid");
|
let url = url::Url::parse(&server_config.url).expect("Config url is invalid");
|
||||||
let host = url
|
let hostname = url
|
||||||
.host_str()
|
.host_str()
|
||||||
.expect("Hostname is missing in the config url")
|
.expect("Hostname is missing in the config url")
|
||||||
.to_owned();
|
.to_owned();
|
||||||
let hostname = url
|
let host = match url.port() {
|
||||||
.domain()
|
Some(port) => format!("{}:{}", hostname, port),
|
||||||
.expect("Domain is missing in the config url")
|
None => hostname.clone(),
|
||||||
.to_owned();
|
};
|
||||||
let scheme = url.scheme().to_owned();
|
let scheme = url.scheme().to_owned();
|
||||||
let ws_scheme = scheme.replace("http", "ws");
|
let ws_scheme = scheme.replace("http", "ws");
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ fn load_config() -> Config {
|
||||||
} else {
|
} else {
|
||||||
server_config.redis.prefix.clone()
|
server_config.redis.prefix.clone()
|
||||||
}
|
}
|
||||||
.unwrap_or(hostname.clone());
|
.unwrap_or(host.clone());
|
||||||
|
|
||||||
Config {
|
Config {
|
||||||
url: server_config.url,
|
url: server_config.url,
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class extends Channel {
|
||||||
this.listId = params.listId as string;
|
this.listId = params.listId as string;
|
||||||
|
|
||||||
// Check existence and owner
|
// Check existence and owner
|
||||||
const exist = await UserLists.exist({
|
const exist = await UserLists.exists({
|
||||||
where: {
|
where: {
|
||||||
id: this.listId,
|
id: this.listId,
|
||||||
userId: this.user!.id,
|
userId: this.user!.id,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { EventEmitter } from "events";
|
import type { EventEmitter } from "node:events";
|
||||||
import type * as websocket from "websocket";
|
import type * as websocket from "websocket";
|
||||||
import readNote from "@/services/note/read.js";
|
import readNote from "@/services/note/read.js";
|
||||||
import type { User } from "@/models/entities/user.js";
|
import type { User } from "@/models/entities/user.js";
|
||||||
|
|
|
@ -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 Emitter from "strict-event-emitter-types";
|
||||||
import type { Channel } from "@/models/entities/channel.js";
|
import type { Channel } from "@/models/entities/channel.js";
|
||||||
import type { User } from "@/models/entities/user.js";
|
import type { User } from "@/models/entities/user.js";
|
||||||
|
|
Loading…
Reference in New Issue