From 9c1675235c41f0614ebe7c1d91a9a70e784455cc Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 12 Apr 2021 17:03:42 +0200 Subject: [PATCH] Give full independent push service URL --- config.yaml | 2 +- src/api_data/push_notifications_status_api.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index f67c67d..4a23bda 100644 --- a/config.yaml +++ b/config.yaml @@ -35,7 +35,7 @@ independent-push-service: control-token: BADTOKENTOCHANGE # Public access URL pattern (for clients access) {TOKEN_URL} will be replaced by client token - public-url: http://localhost:4500/ws/{TOKEN_URL} + public-url: ws://localhost:4500/ws/{TOKEN_URL} # Database configuration diff --git a/src/api_data/push_notifications_status_api.rs b/src/api_data/push_notifications_status_api.rs index 2e7fcd9..38eb194 100644 --- a/src/api_data/push_notifications_status_api.rs +++ b/src/api_data/push_notifications_status_api.rs @@ -2,12 +2,13 @@ use serde::Serialize; +use crate::data::config::conf; use crate::data::user_token::PushNotificationToken; #[derive(Serialize)] pub struct PushNotificationsStatusAPI { pub status: String, - pub independent_push_token: Option, + pub independent_push_url: Option, } impl PushNotificationsStatusAPI { @@ -20,8 +21,9 @@ impl PushNotificationsStatusAPI { PushNotificationToken::FIREBASE(_) => "firebase", }.to_string(), - independent_push_token: match t { - PushNotificationToken::INDEPENDENT(i) => Some(i.to_string()), + independent_push_url: match (t, &conf().independent_push_service) { + (PushNotificationToken::INDEPENDENT(i), Some(conf)) => + Some(conf.public_url.replace("{TOKEN_URL}", i)), _ => None, }, }