Compare commits
No commits in common. "dev2" and "old-master" have entirely different histories.
dev2
...
old-master
|
@ -1,7 +0,0 @@
|
|||
[*]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[Makefile]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
1
.envrc
|
@ -1 +0,0 @@
|
|||
export DATABASE_URL=sqlite://$(pwd)/test.db
|
19
.gitignore
vendored
|
@ -1,13 +1,8 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
/target
|
||||
test.db*
|
||||
/.env
|
||||
/output.log
|
||||
/config.toml
|
||||
/public
|
||||
/hellosu
|
||||
/hellosu.db*
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
pnpm-lock.yaml
|
3
.vscode/extensions.json
vendored
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
|
||||
}
|
2
.vscode/settings.json
vendored
|
@ -1,2 +0,0 @@
|
|||
{
|
||||
}
|
6139
Cargo.lock
generated
|
@ -1,2 +1,4 @@
|
|||
workspace.resolver = "2"
|
||||
workspace.members = ["src-tauri", "core"]
|
||||
[workspace]
|
||||
members = [
|
||||
"daemon",
|
||||
]
|
||||
|
|
31
biome.json
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"vcs": {
|
||||
"enabled": false,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": false
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": false,
|
||||
"ignore": []
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "tab"
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"style": { "useConst": "warn" }
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
}
|
||||
}
|
BIN
bun.lockb
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "panorama-core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.93"
|
||||
prost = "0.13.3"
|
||||
sqlx = { version = "0.8.2", features = ["runtime-tokio", "sqlite"] }
|
||||
tonic = "0.12.3"
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.12.3"
|
|
@ -1,4 +0,0 @@
|
|||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::compile_protos("src/proto/panorama.proto")?;
|
||||
Ok(())
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
DROP TABLE "mail_message";
|
||||
DROP TABLE "mail_mailbox";
|
||||
DROP TABLE "mail_account";
|
||||
DROP TABLE "node";
|
|
@ -1,41 +0,0 @@
|
|||
CREATE TABLE "node" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"name" TEXT,
|
||||
|
||||
"created_at" DATETIME NOT NULL,
|
||||
"updated_at" DATETIME NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "mail_account" (
|
||||
"node_id" TEXT NOT NULL PRIMARY KEY,
|
||||
|
||||
"imap_server_host" TEXT,
|
||||
"imap_server_port" INT,
|
||||
"imap_server_auth_method" TEXT,
|
||||
"imap_server_auth_username" TEXT,
|
||||
"imap_server_auth_password" TEXT,
|
||||
|
||||
"smtp_server_host" TEXT,
|
||||
"smtp_server_port" INT,
|
||||
|
||||
FOREIGN KEY ("node_id") REFERENCES "node"("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "mail_mailbox" (
|
||||
"node_id" TEXT NOT NULL PRIMARY KEY,
|
||||
"mail_account_id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
|
||||
FOREIGN KEY ("node_id") REFERENCES "node"("id"),
|
||||
FOREIGN KEY ("mail_account_id") REFERENCES "mail_account"("node_id")
|
||||
);
|
||||
|
||||
CREATE TABLE "maiL_message" (
|
||||
"node_id" TEXT NOT NULL PRIMARY KEY,
|
||||
"mail_account_id" TEXT NOT NULL,
|
||||
"mail_mailbox_id" TEXT NOT NULL,
|
||||
|
||||
FOREIGN KEY ("node_id") REFERENCES "node"("id"),
|
||||
FOREIGN KEY ("mail_account_id") REFERENCES "mail_account"("node_id")
|
||||
FOREIGN KEY ("mail_mailbox_id") REFERENCES "mail_mailbox"("node_id")
|
||||
);
|
|
@ -1,15 +0,0 @@
|
|||
use anyhow::Result;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
pub struct PanoramaDatabase(SqlitePool);
|
||||
|
||||
pub struct EnsureMailAccount {
|
||||
imap_server_host: String,
|
||||
imap_server_port: u16,
|
||||
}
|
||||
|
||||
impl PanoramaDatabase {
|
||||
pub async fn ensure_mail_account(&self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
mod server_proto {
|
||||
tonic::include_proto!("panorama");
|
||||
}
|
||||
|
||||
mod dal;
|
||||
mod server;
|
|
@ -1,13 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package panorama;
|
||||
|
||||
service Panorama {
|
||||
// Mail service
|
||||
rpc EnsureMailAccount(EnsureMailAccountRequest) returns (EnsureMailAccountReply);
|
||||
}
|
||||
|
||||
message EnsureMailAccountRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message EnsureMailAccountReply {}
|
|
@ -1,21 +0,0 @@
|
|||
use tonic::{Request, Response, Result};
|
||||
|
||||
use crate::dal::PanoramaDatabase;
|
||||
use crate::server_proto::panorama_server::Panorama as PanoramaServerProto;
|
||||
use crate::server_proto::{EnsureMailAccountReply, EnsureMailAccountRequest};
|
||||
|
||||
pub struct Panorama {
|
||||
db: PanoramaDatabase,
|
||||
}
|
||||
|
||||
impl Panorama {}
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl PanoramaServerProto for Panorama {
|
||||
async fn ensure_mail_account(
|
||||
&self,
|
||||
req: Request<EnsureMailAccountRequest>,
|
||||
) -> Result<Response<EnsureMailAccountReply>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
16
daemon/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "panorama-daemon"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.42"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
tokio = { version = "1.9.0", features = ["full"] }
|
||||
clap = "3.0.0-beta.2"
|
||||
futures = "0.3.16"
|
||||
inotify = { version = "0.9.3", features = ["stream"] }
|
||||
xdg = "2.2.0"
|
||||
log = "0.4.14"
|
||||
toml = "0.5.8"
|
||||
stderrlog = "0.5.1"
|
84
daemon/src/config/mod.rs
Normal file
|
@ -0,0 +1,84 @@
|
|||
mod watcher;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
pub use self::watcher::spawn_config_watcher_system;
|
||||
|
||||
/// Configuration
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Config {
|
||||
/// Version of the config to use
|
||||
/// (potentially for migration later?)
|
||||
pub version: String,
|
||||
|
||||
/// Directory to store panorama-related data in
|
||||
pub data_dir: PathBuf,
|
||||
|
||||
/// Mail accounts
|
||||
#[serde(rename = "mail")]
|
||||
pub mail_accounts: HashMap<String, MailAccountConfig>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub async fn from_file(path: impl AsRef<Path>) -> Result<Self> {
|
||||
let mut file = File::open(path.as_ref())?;
|
||||
let mut contents = Vec::new();
|
||||
file.read_to_end(&mut contents)?;
|
||||
let config = toml::from_slice(&contents)?;
|
||||
Ok(config)
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration for a single mail account
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct MailAccountConfig {
|
||||
/// Imap
|
||||
pub imap: ImapConfig,
|
||||
}
|
||||
|
||||
/// Configuring an IMAP server
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ImapConfig {
|
||||
/// Host of the IMAP server (needs to be hostname for TLS)
|
||||
pub server: String,
|
||||
|
||||
/// Port of the IMAP server
|
||||
pub port: u16,
|
||||
|
||||
/// TLS
|
||||
pub tls: TlsMethod,
|
||||
|
||||
/// Auth
|
||||
#[serde(flatten)]
|
||||
pub auth: ImapAuth,
|
||||
}
|
||||
|
||||
/// Method of authentication for the IMAP server
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(tag = "auth")]
|
||||
pub enum ImapAuth {
|
||||
/// Use plain username/password authentication
|
||||
#[serde(rename = "plain")]
|
||||
Plain { username: String, password: String },
|
||||
}
|
||||
|
||||
/// Describes when to perform the TLS handshake
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub enum TlsMethod {
|
||||
/// Perform TLS handshake immediately upon connection
|
||||
#[serde(rename = "on")]
|
||||
On,
|
||||
|
||||
/// Perform TLS handshake after issuing the STARTTLS command
|
||||
#[serde(rename = "starttls")]
|
||||
Starttls,
|
||||
|
||||
/// Don't perform TLS handshake at all (unsecured)
|
||||
#[serde(rename = "off")]
|
||||
Off,
|
||||
}
|
81
daemon/src/config/watcher.rs
Normal file
|
@ -0,0 +1,81 @@
|
|||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use futures::{future::TryFutureExt, stream::StreamExt};
|
||||
use inotify::{Inotify, WatchMask};
|
||||
use tokio::{sync::watch, task::JoinHandle};
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
use super::Config;
|
||||
|
||||
pub type ConfigWatcher = watch::Receiver<Config>;
|
||||
|
||||
/// Start the entire config watcher system, and return a [ConfigWatcher][self::ConfigWatcher],
|
||||
/// which is a cloneable receiver of config update events.
|
||||
pub fn spawn_config_watcher_system() -> Result<(JoinHandle<()>, ConfigWatcher)> {
|
||||
let mut inotify = Inotify::init()?;
|
||||
let xdg = BaseDirectories::new()?;
|
||||
let config_home = xdg.get_config_home().join("panorama");
|
||||
if !config_home.exists() {
|
||||
fs::create_dir_all(&config_home)?;
|
||||
}
|
||||
|
||||
inotify
|
||||
.add_watch(&config_home, WatchMask::CLOSE_WRITE)
|
||||
.context("adding watch for config home")?;
|
||||
|
||||
debug!("watching {:?}", config_home);
|
||||
let (config_tx, config_update) = watch::channel(Config::default());
|
||||
let handle = tokio::spawn(
|
||||
start_inotify_stream(inotify, config_home, config_tx).unwrap_or_else(|_err| todo!()),
|
||||
);
|
||||
Ok((handle, config_update))
|
||||
}
|
||||
|
||||
async fn start_inotify_stream(
|
||||
mut inotify: Inotify,
|
||||
config_home: impl AsRef<Path>,
|
||||
config_tx: watch::Sender<Config>,
|
||||
) -> Result<()> {
|
||||
let mut buffer = vec![0u8; 1024];
|
||||
let mut event_stream = inotify.event_stream(&mut buffer)?;
|
||||
let config_home = config_home.as_ref().to_path_buf();
|
||||
let config_path = config_home.join("panorama.toml");
|
||||
|
||||
// first shot
|
||||
{
|
||||
let config = Config::from_file(&config_path).await?;
|
||||
config_tx.send(config)?;
|
||||
}
|
||||
|
||||
debug!("listening for inotify events");
|
||||
while let Some(v) = event_stream.next().await {
|
||||
let event = v.context("event")?;
|
||||
debug!("inotify event: {:?}", event);
|
||||
if let Some(name) = event.name {
|
||||
let path = PathBuf::from(name);
|
||||
let path_c = config_home
|
||||
.clone()
|
||||
.join(path.clone())
|
||||
.canonicalize()
|
||||
.context("osu")?;
|
||||
if !path_c.exists() {
|
||||
debug!("path {:?} doesn't exist", path_c);
|
||||
continue;
|
||||
}
|
||||
// TODO: any better way to do this?
|
||||
let config_path_c = config_path.canonicalize().context("cfg_path")?;
|
||||
if config_path_c != path_c {
|
||||
debug!("did not match {:?} {:?}", config_path_c, path_c);
|
||||
continue;
|
||||
}
|
||||
|
||||
debug!("reading config from {:?}", path_c);
|
||||
let config = Config::from_file(path_c).await.context("read")?;
|
||||
// debug!("sending config {:?}", config);
|
||||
config_tx.send(config)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
1
daemon/src/imap.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub struct ImapClient {}
|
66
daemon/src/main.rs
Normal file
|
@ -0,0 +1,66 @@
|
|||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate futures;
|
||||
|
||||
mod config;
|
||||
mod imap;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Clap;
|
||||
use futures::future::FutureExt;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
type ExitListener = oneshot::Receiver<()>;
|
||||
|
||||
/// The panorama daemon runs in the background and communicates with other panorama components over Unix sockets.
|
||||
#[derive(Debug, Clap)]
|
||||
struct Options {
|
||||
// /// Config file path (defaults to XDG)
|
||||
// #[clap(long = "config", short = 'c')]
|
||||
// config_file: Option<PathBuf>,
|
||||
/// Verbose mode (-v, -vv, -vvv, etc)
|
||||
#[clap(short = 'v', long = "verbose", parse(from_occurrences))]
|
||||
verbose: usize,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let opt = Options::parse();
|
||||
println!("{:?}", opt);
|
||||
|
||||
stderrlog::new()
|
||||
.module(module_path!())
|
||||
.verbosity(opt.verbose)
|
||||
.init()
|
||||
.unwrap();
|
||||
|
||||
let (_, mut config_watcher) = config::spawn_config_watcher_system()?;
|
||||
|
||||
loop {
|
||||
let (exit_tx, exit_rx) = oneshot::channel();
|
||||
let new_config = config_watcher.borrow().clone();
|
||||
tokio::spawn(run_with_config(new_config, exit_rx));
|
||||
|
||||
// wait till the config has changed, then tell the current thread to stop
|
||||
config_watcher.changed().await?;
|
||||
let _ = exit_tx.send(());
|
||||
}
|
||||
}
|
||||
|
||||
async fn run_with_config(config: Config, exit: ExitListener) -> Result<()> {
|
||||
println!("run with config: {:?}", config);
|
||||
|
||||
let mut exit = exit.fuse();
|
||||
loop {
|
||||
select! {
|
||||
_ = exit => break,
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
1
docs/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
book
|
|
@ -1,6 +0,0 @@
|
|||
[book]
|
||||
authors = ["Michael Zhang"]
|
||||
language = "en"
|
||||
multilingual = false
|
||||
src = "src"
|
||||
title = "panorama docs"
|
|
@ -1,3 +0,0 @@
|
|||
# Summary
|
||||
|
||||
- [Chapter 1](./chapter_1.md)
|
|
@ -1 +0,0 @@
|
|||
# Chapter 1
|
48
package.json
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"name": "panorama",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fortawesome/free-brands-svg-icons": "^6.6.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
||||
"@iconify-json/mdi": "^1.2.1",
|
||||
"@iconify/json": "^2.2.267",
|
||||
"@iconify/svelte": "^4.0.2",
|
||||
"@tanstack/svelte-query": "^5.61.3",
|
||||
"@tauri-apps/api": "^2",
|
||||
"@tauri-apps/plugin-shell": "^2",
|
||||
"@vanilla-extract/css": "^1.16.0",
|
||||
"classnames": "^2.5.1",
|
||||
"svelte-fa": "^4.0.3",
|
||||
"unplugin-icons": "^0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@sveltejs/adapter-static": "^3.0.5",
|
||||
"@sveltejs/kit": "^2.7.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@vanilla-extract/vite-plugin": "^4.0.17",
|
||||
"sass-embedded": "^1.80.6",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.0",
|
||||
"tslib": "^2.8.0",
|
||||
"typescript": "^5.5.0",
|
||||
"vite": "^5.4.10"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"@biomejs/biome",
|
||||
"@sveltejs/kit",
|
||||
"esbuild"
|
||||
]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
tab_spaces = 2
|
7
src-tauri/.gitignore
vendored
|
@ -1,7 +0,0 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Generated by Tauri
|
||||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
|
@ -1,26 +0,0 @@
|
|||
[package]
|
||||
name = "panorama"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
# The `_lib` suffix may seem redundant but it is necessary
|
||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||
name = "panorama_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-shell = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sea-orm = { version = "1.1.1", features = ["sqlx-sqlite", "runtime-tokio-rustls", "macros"] }
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 974 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 903 B |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 14 KiB |
|
@ -1,14 +0,0 @@
|
|||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.invoke_handler(tauri::generate_handler![greet])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
panorama_lib::run()
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "panorama",
|
||||
"version": "0.1.0",
|
||||
"identifier": "io.mzhang.panorama",
|
||||
"build": {
|
||||
"beforeDevCommand": "bun run dev",
|
||||
"devUrl": "http://localhost:1420",
|
||||
"beforeBuildCommand": "bun run build",
|
||||
"frontendDist": "../build"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "panorama",
|
||||
"width": 800,
|
||||
"height": 600
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
0
src/app.d.ts
vendored
13
src/app.html
|
@ -1,13 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Tauri + SvelteKit + Typescript App</title>
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,47 +0,0 @@
|
|||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
<div class="sidebar">
|
||||
<div class="top">
|
||||
<button class="item">Home</button>
|
||||
<button class="item">Mail</button>
|
||||
<button class="item">Recipes</button>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="bottom">
|
||||
<button class="item">Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.top,
|
||||
.bottom {
|
||||
padding: 0.75rem;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
|
||||
.item {
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
background: transparent;
|
||||
border: 1px solid gray;
|
||||
border-radius: 0.5rem;
|
||||
aspect-ratio: 1;
|
||||
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1 +0,0 @@
|
|||
<h1>Mail Accounts</h1>
|
|
@ -1,10 +0,0 @@
|
|||
html,body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
// Tauri doesn't have a Node.js server to do proper SSR
|
||||
// so we will use adapter-static to prerender the app (SSG)
|
||||
// See: https://v2.tauri.app/start/frontend/sveltekit/ for more info
|
||||
export const prerender = true;
|
||||
export const ssr = false;
|
|
@ -1,60 +0,0 @@
|
|||
<script>
|
||||
import {} from "@tanstack/svelte-query";
|
||||
import "../global.scss";
|
||||
import Sidebar from "../components/composite/sidebar/Sidebar.svelte";
|
||||
import MailAccounts from "../components/pages/MailAccounts.svelte";
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="sidebar">
|
||||
<Sidebar />
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
<h1>panorama</h1>
|
||||
|
||||
<input type="text" placeholder="Search..." />
|
||||
</div>
|
||||
|
||||
<main class="container">
|
||||
<MailAccounts />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
border-right: 1px solid lightgray;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex-grow: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 0.75rem;
|
||||
border-bottom: 1px solid lightgray;
|
||||
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,4 +0,0 @@
|
|||
// Cribbed from https://github.com/cinnyapp/folds/blob/d5e4f8a3d48ae70d54e77a05808f5200e74072fb/src/theme/util.ts#L1
|
||||
// Just going to use this for now until I figure out my own system
|
||||
export const pxToRem = (px: number) => Number.parseFloat((px / 16).toFixed(4));
|
||||
export const toRem = (px: number) => `${pxToRem(px)}rem`;
|
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>
|
Before Width: | Height: | Size: 1.9 KiB |
|
@ -1,6 +0,0 @@
|
|||
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
||||
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.5 KiB |
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1,16 +0,0 @@
|
|||
// Tauri doesn't have a Node.js server to do proper SSR
|
||||
// so we will use adapter-static to prerender the app (SSG)
|
||||
// See: https://v2.tauri.app/start/frontend/sveltekit/ for more info
|
||||
import adapter from "@sveltejs/adapter-static";
|
||||
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
preprocess: vitePreprocess(),
|
||||
compilerOptions: { runes: true },
|
||||
kit: {
|
||||
adapter: adapter(),
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
import { defineConfig } from "vite";
|
||||
import { sveltekit } from "@sveltejs/kit/vite";
|
||||
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
||||
import Icons from "unplugin-icons/vite";
|
||||
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [Icons({ compiler: "svelte" }), vanillaExtractPlugin(), sveltekit()],
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
//
|
||||
// 1. prevent vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// 2. tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
host: host || false,
|
||||
hmr: host
|
||||
? {
|
||||
protocol: "ws",
|
||||
host,
|
||||
port: 1421,
|
||||
}
|
||||
: undefined,
|
||||
watch: {
|
||||
// 3. tell vite to ignore watching `src-tauri`
|
||||
ignored: ["**/src-tauri/**"],
|
||||
},
|
||||
},
|
||||
}));
|