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",
|
||||
"futures",
|
||||
"itertools 0.13.0",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
|
|
|
@ -4,4 +4,11 @@ panorama_version: 0.1.0
|
|||
description: Note taking app
|
||||
|
||||
# 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]
|
||||
pub fn install() -> i32 {
|
||||
println!("SHIET");
|
||||
// panorama_app_sdk::register_endpoint("/get_todays_date");
|
||||
123
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ macro_rules! init {
|
|||
static ALLOC: panorama_app_sdk::wee_alloc::WeeAlloc =
|
||||
panorama_app_sdk::wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
#[cfg(no_std)]
|
||||
#[panic_handler]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
loop {}
|
||||
|
|
|
@ -10,6 +10,7 @@ bimap = "0.6.3"
|
|||
chrono = { version = "0.4.38", features = ["serde"] }
|
||||
futures = "0.3.30"
|
||||
itertools = "0.13.0"
|
||||
schemars = "0.8.21"
|
||||
serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.117"
|
||||
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]
|
||||
pub mod macros;
|
||||
pub mod internal;
|
||||
pub mod manifest;
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
@ -12,13 +13,12 @@ use std::{
|
|||
use anyhow::{anyhow, Context as _, Result};
|
||||
use internal::{WasmtimeInstanceEnv, WasmtimeModule};
|
||||
use itertools::Itertools;
|
||||
use wasmtime::{
|
||||
AsContext, Caller, Config, Engine, Instance, Linker, Memory, Module, Store,
|
||||
};
|
||||
use wasmtime_wasi::WasiCtxBuilder;
|
||||
use wasmtime::{AsContext, Config, Engine, Linker, Memory, Module, Store};
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
use self::manifest::AppManifest;
|
||||
|
||||
pub type AllAppData = HashMap<String, AppData>;
|
||||
|
||||
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)]
|
||||
pub struct AppData {
|
||||
name: String,
|
||||
|
|
|
@ -7,7 +7,7 @@ pub mod node;
|
|||
pub mod node_raw;
|
||||
// pub mod utils;
|
||||
|
||||
use std::{fs, path::Path};
|
||||
use std::{collections::HashMap, fs, path::Path};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use bimap::BiMap;
|
||||
|
@ -21,6 +21,7 @@ use tantivy::{
|
|||
schema::{Field, Schema, STORED, STRING, TEXT},
|
||||
Index,
|
||||
};
|
||||
use wasmtime::Module;
|
||||
|
||||
use crate::{
|
||||
// mail::MailWorker,
|
||||
|
@ -46,6 +47,8 @@ pub struct AppState {
|
|||
pub db: SqlitePool,
|
||||
pub tantivy_index: Index,
|
||||
pub tantivy_field_map: BiMap<String, Field>,
|
||||
|
||||
pub app_wasm_modules: HashMap<String, Module>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
|
|
|
@ -3,6 +3,8 @@ use anyhow::Result;
|
|||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
panorama_daemon::run().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ async fn main() {
|
|||
Some(Command::Daemon) => {
|
||||
panorama_daemon::run().await;
|
||||
}
|
||||
|
||||
None => {
|
||||
if !opt.no_embedded_daemon {
|
||||
tokio::spawn(panorama_daemon::run());
|
||||
|
|
Loading…
Reference in a new issue