chore: moved version as const

This commit is contained in:
əlemi 2024-03-25 05:02:20 +01:00
parent 7f69abf6c0
commit de74669bd7
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 5 additions and 3 deletions

View file

@ -2,7 +2,7 @@ use axum::{extract::{Path, Query, State}, http::StatusCode, response::{IntoRespo
use jrd::{JsonResourceDescriptor, JsonResourceDescriptorLink}; use jrd::{JsonResourceDescriptor, JsonResourceDescriptorLink};
use sea_orm::{EntityTrait, PaginatorTrait}; use sea_orm::{EntityTrait, PaginatorTrait};
use crate::{model, server::Context}; use crate::{model, server::Context, VERSION};
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
pub struct NodeInfoDiscovery { pub struct NodeInfoDiscovery {
@ -42,7 +42,7 @@ pub async fn nodeinfo(State(ctx): State<Context>, Path(version): Path<String>) -
"2.0.json" => ( "2.0.json" => (
nodeinfo::types::Software { nodeinfo::types::Software {
name: "μpub".to_string(), name: "μpub".to_string(),
version: Some(env!("CARGO_PKG_VERSION").into()), version: Some(VERSION.into()),
repository: None, repository: None,
homepage: None, homepage: None,
}, },
@ -51,7 +51,7 @@ pub async fn nodeinfo(State(ctx): State<Context>, Path(version): Path<String>) -
"2.1.json" => ( "2.1.json" => (
nodeinfo::types::Software { nodeinfo::types::Software {
name: "μpub".to_string(), name: "μpub".to_string(),
version: Some(env!("CARGO_PKG_VERSION").into()), version: Some(VERSION.into()),
repository: Some("https://git.alemi.dev/upub.git/".into()), repository: Some("https://git.alemi.dev/upub.git/".into()),
homepage: None, homepage: None,
}, },

View file

@ -13,6 +13,8 @@ use sea_orm_migration::MigratorTrait;
use crate::activitystream::{BaseType, ObjectType}; use crate::activitystream::{BaseType, ObjectType};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Parser)] #[derive(Parser)]
/// all names were taken /// all names were taken
struct CliArgs { struct CliArgs {