i decided to change my comment thing again

This commit is contained in:
c0repwn3r 2023-04-06 11:41:41 -04:00
parent 2279608f96
commit a5a21ba75b
Signed by: core
GPG Key ID: FDBF740DADDCEECF
12 changed files with 73 additions and 12 deletions

View File

@ -93,6 +93,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.service(routes::v1::roles::get_roles)
.service(routes::v1::roles::get_role)
.service(routes::v1::roles::delete_role)
.service(routes::v1::trifid::trifid_extensions)
}).bind(CONFIG.server.bind)?.run().await?;
Ok(())

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/auth/magic-link t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/auth/magic-link t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{HttpResponse, post};
use actix_web::web::{Data, Json};

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/auth/totp t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/auth/totp t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{HttpRequest, HttpResponse, post};
use actix_web::web::{Data, Json};

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/auth/verify-magic-link t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/auth/verify-magic-link t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{HttpResponse, post};
use actix_web::web::{Data, Json};

View File

@ -5,3 +5,4 @@ pub mod verify_totp_authenticators;
pub mod networks;
pub mod organization;
pub mod roles;
pub mod trifid;

View File

@ -14,13 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#GET /v1/networks t+parity:full t+type:documented t+status:done
//#GET /v1/networks t+parity:full t+type:documented t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been recreated from the original API documentation.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
//
//#GET /v1/networks/{network_id} t+parity:full t+type:documented t+status:done
//#GET /v1/networks/{network_id} t+parity:full t+type:documented t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been recreated from the original API documentation.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use serde::{Serialize, Deserialize};
use actix_web::{get, HttpRequest, HttpResponse};

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/organization t+parity:none t+type:fabricated t+status:done t+status:want-reveng
//#POST /v1/organization t+parity:none t+type:fabricated t+status:done t+status:want-reveng t+feature:definednetworking
// This is NOT a DN-compatible API. The organization create API has not yet been reverse engineered. This endpoint is a complete fabrication of trifid-api.
// While this endpoint is considered done, help is wanted with reverse engineering the original API. Major features should not be added or removed unless it is replacing this endpoint with the correct, DN-compatible endpoint.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use actix_web::{HttpRequest, HttpResponse};

View File

@ -14,13 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/roles t+parity:full t+type:documented t+status:done
//#POST /v1/roles t+parity:full t+type:documented t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been recreated from the original API documentation.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
//
//#GET /v1/roles t+parity:full t+type:documented t+status:done
//#GET /v1/roles t+parity:full t+type:documented t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been recreated from the original API documentation.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
//
//#GET /v1/roles/{role_id} t+parity:full t+type:documented t+status:done
// This endpoint has full parity with the original API. It has been recreated from the original API documentation.

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/signup t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/signup t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{HttpResponse, post};
use actix_web::web::{Data, Json};

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/totp-authenticators t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/totp-authenticators t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use serde::{Serialize, Deserialize};
use actix_web::{HttpRequest, HttpResponse, post};

View File

@ -0,0 +1,48 @@
// trifid-api, an open source reimplementation of the Defined Networking nebula management server.
// Copyright (C) 2023 c0repwn3r
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#GET /v1/trifid_extensions t+parity:none t+type:fabricated t+status:done t+status:special t+features:trifidextensions
// This is NOT a DN-compatible API. This endpoint is a fabrication of trifid-api to enable the TrifidExtensions codebase for clients. This allows clients to access additional functionality only available on servers that support it.
// This endpoint is considered done. It should not be modified unless for bugfixes.
// This endpoint is a special endpoint, and may impact what features client are able to access.
// This endpoint requires the `trifidextensions` extension to be enabled to be used.
//
// This endpoint implements the TrifidExtensions API extension framework. This allows the server to optionally provide extra features and endpoints to clients that support it,
// by providing an endpoint to allow the client to check which API extensions are enabled.
// The following extensions are available:
// - definednetworking - Base DN api, must be enabled on all servers compatible with the original DN api
// - trifidextensions - Enables the TrifidExtensions codebase
// - extended_roles - Enables extra actions when editing roles (see the list of special endpoints in roles.rs)
// - extended_hosts - Enables extra actions when editing hosts (see the list of special endpoints in hosts.rs)
//
// A client should GET /v1/trifid_extensions upon creating a new connection to an API server, to check which features it supports.
// If the request returns a non-200 response, or does not follow the typical TrifidExtensions schema, that server should be assumed to only support t+features:definednetworking.
// Endpoint specs (#REQTYPE) can indicate they require a feature by adding t+features:[feature]
use actix_web::{HttpResponse, get};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct TrifidExtensionsResponse {
pub extensions: Vec<String>
}
#[get("/v1/trifid_extensions")]
pub async fn trifid_extensions() -> HttpResponse {
HttpResponse::Ok().json(TrifidExtensionsResponse {
extensions: vec!["definednetworking".to_string(), "trifidextensions".to_string(), "extended_roles".to_string(), "extended_hosts".to_string()],
})
}

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v1/verify-totp-authenticators t+parity:full t+type:reverse_engineered t+status:done
//#POST /v1/verify-totp-authenticators t+parity:full t+type:reverse_engineered t+status:done t+feature:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{HttpRequest, HttpResponse, post};
use actix_web::web::{Data, Json};