From de74669bd7b4b5b42f632ede42fe78070c86fb55 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 25 Mar 2024 05:02:20 +0100 Subject: [PATCH] chore: moved version as const --- src/activitypub/well_known.rs | 6 +++--- src/main.rs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/activitypub/well_known.rs b/src/activitypub/well_known.rs index 910e73e5..96a52853 100644 --- a/src/activitypub/well_known.rs +++ b/src/activitypub/well_known.rs @@ -2,7 +2,7 @@ use axum::{extract::{Path, Query, State}, http::StatusCode, response::{IntoRespo use jrd::{JsonResourceDescriptor, JsonResourceDescriptorLink}; use sea_orm::{EntityTrait, PaginatorTrait}; -use crate::{model, server::Context}; +use crate::{model, server::Context, VERSION}; #[derive(serde::Serialize)] pub struct NodeInfoDiscovery { @@ -42,7 +42,7 @@ pub async fn nodeinfo(State(ctx): State, Path(version): Path) - "2.0.json" => ( nodeinfo::types::Software { name: "μpub".to_string(), - version: Some(env!("CARGO_PKG_VERSION").into()), + version: Some(VERSION.into()), repository: None, homepage: None, }, @@ -51,7 +51,7 @@ pub async fn nodeinfo(State(ctx): State, Path(version): Path) - "2.1.json" => ( nodeinfo::types::Software { name: "μpub".to_string(), - version: Some(env!("CARGO_PKG_VERSION").into()), + version: Some(VERSION.into()), repository: Some("https://git.alemi.dev/upub.git/".into()), homepage: None, }, diff --git a/src/main.rs b/src/main.rs index e86cf31c..478ebb43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,8 @@ use sea_orm_migration::MigratorTrait; use crate::activitystream::{BaseType, ObjectType}; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + #[derive(Parser)] /// all names were taken struct CliArgs {