Skip to content

Commit

Permalink
resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdoesdev committed Nov 7, 2023
2 parents 9087f0d + d35198a commit 013385c
Show file tree
Hide file tree
Showing 149 changed files with 1,296 additions and 1,244 deletions.
20 changes: 2 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,7 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: linux_musl_x86_64
path: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}*
- name: Build-musl
uses: gmiam/rust-musl-action@9e6a37bf27ecfffb6b92240ea276bea5487fa15d
continue-on-error: false
with:
args: cargo build --target $BUILD_TARGET --release --features controller
- uses: actions/upload-artifact@v2
with:
name: fastn_controller_linux_musl_x86_64
path: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}*
path: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}
release-windows:
name: Build for Windows
runs-on: windows-latest
Expand Down Expand Up @@ -131,10 +122,6 @@ jobs:
with:
name: linux_musl_x86_64
path: ~/download/linux_musl
- uses: actions/download-artifact@v2
with:
name: fastn_controller_linux_musl_x86_64
path: ~/download/fastn_controller_linux_musl
- uses: actions/download-artifact@v2
with:
name: windows_x64_latest
Expand All @@ -149,16 +136,13 @@ jobs:
mv ~/download/windows/windows_x64_installer.exe ~/download/windows/fastn_setup.exe
mv ~/download/macos/fastn ~/download/macos/fastn_macos_x86_64
mv ~/download/linux_musl/fastn ~/download/linux_musl/fastn_linux_musl_x86_64
mv ~/download/linux_musl/fastn.d ~/download/linux_musl/fastn_linux_musl_x86_64.d
mv ~/download/fastn_controller_linux_musl/fastn ~/download/fastn_controller_linux_musl/fastn_controller_linux_musl_x86_64
mv ~/download/fastn_controller_linux_musl/fastn.d ~/download/fastn_controller_linux_musl/fastn_controller_linux_musl_x86_64.d
- name: Update .github/RELEASE_TEMPLATE.md
run: |
sed -i "s/GITHUB_SHA/${GITHUB_SHA}/g" .github/RELEASE_TEMPLATE.md
sed -i "s/DATE/$(date)/g" .github/RELEASE_TEMPLATE.md
- uses: ncipollo/release-action@v1
with:
artifacts: "~/download/windows/fastn_windows_x86_64.exe,~/download/windows/fastn_setup.exe,~/download/macos/fastn_macos_x86_64,~/download/linux_musl/fastn_linux_musl_x86_64,~/download/linux_musl/fastn_linux_musl_x86_64.d,~/download/fastn_controller_linux_musl/fastn_controller_linux_musl_x86_64,~/download/fastn_controller_linux_musl/fastn_controller_linux_musl_x86_64.d"
artifacts: "~/download/windows/fastn_windows_x86_64.exe,~/download/windows/fastn_setup.exe,~/download/macos/fastn_macos_x86_64,~/download/linux_musl/fastn_linux_musl_x86_64"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.inputs.releaseTag }}
Expand Down
110 changes: 9 additions & 101 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ members = [
"fastn-issues",
"fastn-js",
"fastn-grammar",
"foo",
# "fastn-wasm",
# "fastn-runtime",
]
exclude = ["fastn-runtime", "fastn-wasm"]
resolver = "2"

[workspace.package]
version = "0.3.0"
authors = [
"Amit Upadhyay <[email protected]>",
"Arpita Jaiswal <[email protected]>",
Expand Down Expand Up @@ -90,6 +90,8 @@ format_num = "0.1"
ftd = { path = "ftd" }
fastn-js = { path = "fastn-js" }
futures = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std"] }
futures-core = "0.3"
home = "0.5"
ignore = "0.4"
include_dir = "0.7"
Expand Down
3 changes: 2 additions & 1 deletion fastn-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ github-auth = ["dep:oauth2"]

[dependencies]
actix-web.workspace = true
actix-web-lab.workspace = true
antidote.workspace = true
async-lock.workspace = true
dirs.workspace = true
Expand All @@ -41,6 +40,8 @@ clap.workspace = true
colored.workspace = true
native-tls.workspace = true
deadpool-postgres.workspace = true
futures-util.workspace = true
futures-core.workspace = true
postgres-types.workspace = true
postgres-native-tls.workspace = true
tokio-postgres.workspace = true
Expand Down
15 changes: 8 additions & 7 deletions fastn-core/src/apis/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ fn query(uri: &str) -> fastn_core::Result<QueryParams> {
})
}

pub async fn clear(req: &fastn_core::http::Request) -> fastn_core::http::Response {
pub async fn clear(
config: &fastn_core::Config,
req: &fastn_core::http::Request,
) -> fastn_core::http::Response {
let query = match query(req.uri()) {
Ok(q) => q,
Err(err) => {
Expand All @@ -50,7 +53,7 @@ pub async fn clear(req: &fastn_core::http::Request) -> fastn_core::http::Respons
}
};

if let Err(err) = clear_(&query, req).await {
if let Err(err) = clear_(config, &query, req).await {
return fastn_core::server_error!(
"fastn-Error: /-/clear-cache/, query: {:?}, error: {:?}",
query,
Expand All @@ -62,12 +65,10 @@ pub async fn clear(req: &fastn_core::http::Request) -> fastn_core::http::Respons
}

pub async fn clear_(
config: &fastn_core::Config,
query: &QueryParams,
req: &fastn_core::http::Request,
_req: &fastn_core::http::Request,
) -> fastn_core::Result<()> {
let config =
fastn_core::time("Config::read()")
.it(fastn_core::Config::read(None, false, Some(req)).await?);
if config.package.download_base_url.is_none() {
return Err(fastn_core::Error::APIResponseError(
"cannot remove anything, package does not have `download_base_url`".to_string(),
Expand Down Expand Up @@ -112,7 +113,7 @@ pub async fn clear_(

// Download FASTN.ftd again after removing all the content
if !config.root.join("FASTN.ftd").exists() {
fastn_core::commands::serve::download_init_package(config.package.download_base_url)
fastn_core::commands::serve::download_init_package(&config.package.download_base_url)
.await?;
}

Expand Down
9 changes: 3 additions & 6 deletions fastn-core/src/apis/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ pub struct CloneResponse {
pub reserved_crs: Vec<i32>,
}

pub async fn clone(
req: fastn_core::http::Request,
) -> fastn_core::Result<fastn_core::http::Response> {
pub async fn clone(config: &fastn_core::Config) -> fastn_core::Result<fastn_core::http::Response> {
// TODO: implement authentication
match clone_worker(req).await {
match clone_worker(config).await {
Ok(data) => fastn_core::http::api_ok(data),
Err(err) => fastn_core::http::api_error(err.to_string()),
}
}

async fn clone_worker(req: fastn_core::http::Request) -> fastn_core::Result<CloneResponse> {
async fn clone_worker(config: &fastn_core::Config) -> fastn_core::Result<CloneResponse> {
use itertools::Itertools;

let config = fastn_core::Config::read(None, false, Some(&req)).await?;
let all_files = config
.get_all_file_path(&config.package, Default::default())?
.into_iter()
Expand Down
21 changes: 12 additions & 9 deletions fastn-core/src/apis/cr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub struct CreateCRRequest {
}

pub async fn create_cr(
req: &fastn_core::http::Request,
config: &fastn_core::Config,
cr_req: CreateCRRequest,
) -> fastn_core::Result<fastn_core::http::Response> {
match create_cr_worker(req, cr_req).await {
match create_cr_worker(config, cr_req).await {
Ok(cr_number) => {
#[derive(serde::Serialize)]
struct CreateCRResponse {
Expand All @@ -21,35 +21,35 @@ pub async fn create_cr(
}

async fn create_cr_worker(
req: &fastn_core::http::Request,
config: &fastn_core::Config,
cr_request: CreateCRRequest,
) -> fastn_core::Result<usize> {
let config = fastn_core::Config::read(None, false, Some(req)).await?;
let cr_number = config.extract_cr_number().await?;
let default_title = format!("CR#{cr_number}");
let cr_meta = fastn_core::cr::CRMeta {
title: cr_request.title.unwrap_or(default_title),
cr_number: cr_number as usize,
open: true,
};
fastn_core::commands::create_cr::add_cr_to_workspace(&config, &cr_meta).await?;
fastn_core::commands::create_cr::add_cr_to_workspace(config, &cr_meta).await?;
Ok(cr_number as usize)
}

pub async fn create_cr_page(
config: &fastn_core::Config,
req: fastn_core::http::Request,
) -> fastn_core::Result<fastn_core::http::Response> {
match create_cr_page_worker(req).await {
match create_cr_page_worker(config, req).await {
Ok(body) => Ok(body),
Err(err) => fastn_core::http::api_error(err.to_string()),
}
}

async fn create_cr_page_worker(
config: &fastn_core::Config,
req: fastn_core::http::Request,
) -> fastn_core::Result<fastn_core::http::Response> {
let mut config = fastn_core::Config::read(None, false, Some(&req)).await?;
let create_cr_ftd = fastn_core::package_info_create_cr(&config)?;
let create_cr_ftd = fastn_core::package_info_create_cr(config)?;

let main_document = fastn_core::Document {
id: "create-cr.ftd".to_string(),
Expand All @@ -58,7 +58,10 @@ async fn create_cr_page_worker(
package_name: config.package.name.clone(),
};

fastn_core::package::package_doc::read_ftd(&mut config, &main_document, "/", false, false)
let mut req_config =
fastn_core::RequestConfig::new(config, &req, main_document.id.as_str(), "/");

fastn_core::package::package_doc::read_ftd(&mut req_config, &main_document, "/", false, false)
.await
.map(Into::into)
}
Loading

0 comments on commit 013385c

Please sign in to comment.