mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
rename "world" to "global" not to cause confusion
This commit is contained in:
parent
13fe329ef0
commit
0507ef58ed
@ -74,7 +74,8 @@ pub enum Message {
|
||||
/// returns active player names
|
||||
ListPlayers,
|
||||
ListLogs,
|
||||
SendWorldMsg {
|
||||
/// sends a msg to everyone on the server
|
||||
SendGlobalMsg {
|
||||
msg: String,
|
||||
},
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ fn server_loop(
|
||||
.collect();
|
||||
let _ = response.send(MessageReturn::Logs(lines));
|
||||
},
|
||||
Message::SendWorldMsg { msg } => {
|
||||
Message::SendGlobalMsg { msg } => {
|
||||
use server::state_ext::StateExt;
|
||||
let msg = ChatType::Meta.into_plain_msg(msg);
|
||||
server.state().send_chat(msg);
|
||||
|
@ -34,8 +34,8 @@ pub struct Settings {
|
||||
/// SECRET API HEADER used to access the chat api, if disabled the API is
|
||||
/// unreachable
|
||||
pub web_chat_secret: Option<String>,
|
||||
/// public SECRET API HEADER used to access the ui api, if disabled the API
|
||||
/// is reachable localhost only
|
||||
/// public SECRET API HEADER used to access the /ui_api, if disabled the API
|
||||
/// is reachable localhost only (by /ui)
|
||||
pub ui_api_secret: Option<String>,
|
||||
pub shutdown_signals: Vec<ShutdownSignal>,
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ pub fn router(web_ui_request_s: UiRequestSender, secret_token: String) -> Router
|
||||
Router::new()
|
||||
.route("/players", get(players))
|
||||
.route("/logs", get(logs))
|
||||
.route("/send_world_msg", post(send_world_msg))
|
||||
.route("/send_global_msg", post(send_global_msg))
|
||||
.layer(axum::middleware::from_fn_with_state(ip_addrs, log_users))
|
||||
.layer(axum::middleware::from_fn_with_state(token, validate_secret))
|
||||
.with_state(web_ui_request_s)
|
||||
@ -109,13 +109,13 @@ struct SendWorldMsgBody {
|
||||
msg: String,
|
||||
}
|
||||
|
||||
async fn send_world_msg(
|
||||
async fn send_global_msg(
|
||||
State(web_ui_request_s): State<UiRequestSender>,
|
||||
Json(payload): Json<SendWorldMsgBody>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
let (dummy_s, _) = tokio::sync::oneshot::channel();
|
||||
let _ = web_ui_request_s
|
||||
.send((Message::SendWorldMsg { msg: payload.msg }, dummy_s))
|
||||
.send((Message::SendGlobalMsg { msg: payload.msg }, dummy_s))
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ async fn ui(
|
||||
r#"<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
Ui is only accissable from 127.0.0.1
|
||||
Ui is only accessible from 127.0.0.1
|
||||
</body>
|
||||
</html>
|
||||
"#
|
||||
|
@ -29,7 +29,7 @@ async function sendGlobalMsg() {
|
||||
var world_msg = document.getElementById("world_msg");
|
||||
const msg_text = world_msg.value;
|
||||
|
||||
const msg_response = await fetch("/ui_api/v1/send_world_msg", {
|
||||
const msg_response = await fetch("/ui_api/v1/send_global_msg", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
Loading…
Reference in New Issue
Block a user