more progress
This commit is contained in:
parent
3e505d8690
commit
08192e1687
10 changed files with 47 additions and 16 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3492,6 +3492,7 @@ dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"futures",
|
"futures",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
|
|
|
@ -4,4 +4,11 @@ panorama_version: 0.1.0
|
||||||
description: Note taking app
|
description: Note taking app
|
||||||
|
|
||||||
# installer_path: ../../target/wasm32-unknown-unknown/wasm-release/panorama_journal.wasm
|
# installer_path: ../../target/wasm32-unknown-unknown/wasm-release/panorama_journal.wasm
|
||||||
installer_path: ../../target/wasm32-unknown-unknown/wasm-debug/panorama_journal.wasm
|
installer_path: ../../target/wasm32-unknown-unknown/wasm-debug/panorama_journal.wasm
|
||||||
|
|
||||||
|
endpoints:
|
||||||
|
- url: /date/:date
|
||||||
|
method: GET
|
||||||
|
export_name: get_date_info
|
||||||
|
|
||||||
|
triggers:
|
|
@ -10,6 +10,5 @@ panorama_app_sdk::init!();
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn install() -> i32 {
|
pub fn install() -> i32 {
|
||||||
println!("SHIET");
|
println!("SHIET");
|
||||||
// panorama_app_sdk::register_endpoint("/get_todays_date");
|
|
||||||
123
|
123
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ macro_rules! init {
|
||||||
static ALLOC: panorama_app_sdk::wee_alloc::WeeAlloc =
|
static ALLOC: panorama_app_sdk::wee_alloc::WeeAlloc =
|
||||||
panorama_app_sdk::wee_alloc::WeeAlloc::INIT;
|
panorama_app_sdk::wee_alloc::WeeAlloc::INIT;
|
||||||
|
|
||||||
|
#[cfg(no_std)]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
|
|
|
@ -10,6 +10,7 @@ bimap = "0.6.3"
|
||||||
chrono = { version = "0.4.38", features = ["serde"] }
|
chrono = { version = "0.4.38", features = ["serde"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
itertools = "0.13.0"
|
itertools = "0.13.0"
|
||||||
|
schemars = "0.8.21"
|
||||||
serde = { version = "1.0.203", features = ["derive"] }
|
serde = { version = "1.0.203", features = ["derive"] }
|
||||||
serde_json = "1.0.117"
|
serde_json = "1.0.117"
|
||||||
serde_yaml = "0.9.34"
|
serde_yaml = "0.9.34"
|
||||||
|
|
25
crates/panorama-core/src/state/apps/manifest.rs
Normal file
25
crates/panorama-core/src/state/apps/manifest.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use schemars::JsonSchema;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
|
pub struct AppManifest {
|
||||||
|
name: String,
|
||||||
|
version: Option<String>,
|
||||||
|
panorama_version: Option<String>,
|
||||||
|
description: Option<String>,
|
||||||
|
installer_path: PathBuf,
|
||||||
|
|
||||||
|
endpoints: Vec<AppManifestEndpoint>,
|
||||||
|
triggers: Vec<AppManifestTriggers>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
|
pub struct AppManifestEndpoint {
|
||||||
|
url: String,
|
||||||
|
method: String,
|
||||||
|
export_name: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
|
pub struct AppManifestTriggers {}
|
|
@ -1,6 +1,7 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod macros;
|
pub mod macros;
|
||||||
pub mod internal;
|
pub mod internal;
|
||||||
|
pub mod manifest;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
|
@ -12,13 +13,12 @@ use std::{
|
||||||
use anyhow::{anyhow, Context as _, Result};
|
use anyhow::{anyhow, Context as _, Result};
|
||||||
use internal::{WasmtimeInstanceEnv, WasmtimeModule};
|
use internal::{WasmtimeInstanceEnv, WasmtimeModule};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use wasmtime::{
|
use wasmtime::{AsContext, Config, Engine, Linker, Memory, Module, Store};
|
||||||
AsContext, Caller, Config, Engine, Instance, Linker, Memory, Module, Store,
|
|
||||||
};
|
|
||||||
use wasmtime_wasi::WasiCtxBuilder;
|
|
||||||
|
|
||||||
use crate::AppState;
|
use crate::AppState;
|
||||||
|
|
||||||
|
use self::manifest::AppManifest;
|
||||||
|
|
||||||
pub type AllAppData = HashMap<String, AppData>;
|
pub type AllAppData = HashMap<String, AppData>;
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
|
@ -65,15 +65,6 @@ impl AppState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
pub struct AppManifest {
|
|
||||||
name: String,
|
|
||||||
version: Option<String>,
|
|
||||||
panorama_version: Option<String>,
|
|
||||||
description: Option<String>,
|
|
||||||
installer_path: PathBuf,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AppData {
|
pub struct AppData {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub mod node;
|
||||||
pub mod node_raw;
|
pub mod node_raw;
|
||||||
// pub mod utils;
|
// pub mod utils;
|
||||||
|
|
||||||
use std::{fs, path::Path};
|
use std::{collections::HashMap, fs, path::Path};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use bimap::BiMap;
|
use bimap::BiMap;
|
||||||
|
@ -21,6 +21,7 @@ use tantivy::{
|
||||||
schema::{Field, Schema, STORED, STRING, TEXT},
|
schema::{Field, Schema, STORED, STRING, TEXT},
|
||||||
Index,
|
Index,
|
||||||
};
|
};
|
||||||
|
use wasmtime::Module;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
// mail::MailWorker,
|
// mail::MailWorker,
|
||||||
|
@ -46,6 +47,8 @@ pub struct AppState {
|
||||||
pub db: SqlitePool,
|
pub db: SqlitePool,
|
||||||
pub tantivy_index: Index,
|
pub tantivy_index: Index,
|
||||||
pub tantivy_field_map: BiMap<String, Field>,
|
pub tantivy_field_map: BiMap<String, Field>,
|
||||||
|
|
||||||
|
pub app_wasm_modules: HashMap<String, Module>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
|
|
|
@ -3,6 +3,8 @@ use anyhow::Result;
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
panorama_daemon::run().await?;
|
panorama_daemon::run().await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ async fn main() {
|
||||||
Some(Command::Daemon) => {
|
Some(Command::Daemon) => {
|
||||||
panorama_daemon::run().await;
|
panorama_daemon::run().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
None => {
|
None => {
|
||||||
if !opt.no_embedded_daemon {
|
if !opt.no_embedded_daemon {
|
||||||
tokio::spawn(panorama_daemon::run());
|
tokio::spawn(panorama_daemon::run());
|
||||||
|
|
Loading…
Reference in a new issue