Add experimental tauri package
This commit is contained in:
parent
87e0f52a3f
commit
d4b03558dc
|
@ -25,3 +25,4 @@ packages/server/attachments
|
|||
/pwa
|
||||
/data
|
||||
packages/extension/dist
|
||||
packages/tauri/dist
|
||||
|
|
19
README.md
19
README.md
|
@ -4,15 +4,16 @@ Simple, secure password and data management for individuals and teams (formerly
|
|||
|
||||
This repo is split into multiple packages:
|
||||
|
||||
| Package Name | Description |
|
||||
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@padloc/core](packages/core) | Core Logic |
|
||||
| [@padloc/app](packages/app) | Web-based UI components |
|
||||
| [@padloc/server](packages/server) | The Backend Server |
|
||||
| [@padloc/pwa](packages/pwa) | The Web Client, a [Progressive Web App](https://developers.google.com/web/progressive-web-apps) built on top of the `@padloc/app` package |
|
||||
| [@padloc/locale](packages/locale) | Package containing translations and other localization-related things |
|
||||
| [@padloc/electron](packages/electron) | The Desktop App, built with Electron |
|
||||
| [@padloc/cordova](packages/cordova) | Cordova project for building iOS and Android app. |
|
||||
| Package Name | Description |
|
||||
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@padloc/core](packages/core) | Core Logic |
|
||||
| [@padloc/app](packages/app) | Web-based UI components |
|
||||
| [@padloc/server](packages/server) | The Backend Server |
|
||||
| [@padloc/pwa](packages/pwa) | The Web Client, a [Progressive Web App](https://developers.google.com/web/progressive-web-apps) built on top of the `@padloc/app` package |
|
||||
| [@padloc/locale](packages/locale) | Package containing translations and other localization-related things |
|
||||
| [@padloc/electron](packages/electron) | The Desktop App, built with Electron |
|
||||
| [@padloc/cordova](packages/cordova) | Cordova project for building iOS and Android app. |
|
||||
| [@padloc/tauri (experimental)](packages/tauri) | Cross-platform native app builder for Padloc, powered by [Tauri](https://github.com/tauri-apps/tauri) |
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# @padloc/tauri (experimental)
|
||||
|
||||
Cross-platform native app builder for Padloc, powered by [Tauri](https://github.com/tauri-apps/tauri).
|
||||
|
||||
## How To Use
|
||||
|
||||
1. Follow the steps described in the [Getting
|
||||
Started](https://github.com/padloc/padloc/blob/master/README.md#getting-started)
|
||||
section of repo readme.
|
||||
|
||||
2. Follow Tauri's [setup guide](https://tauri.studio/docs/getting-started/intro/#setting-up-your-environment) for your platform.
|
||||
|
||||
3. Build the app:
|
||||
|
||||
```sh
|
||||
cd packages/tauri
|
||||
npm run build
|
||||
```
|
||||
|
||||
Don't forget to set the server url [configuration
|
||||
variable](https://github.com/padloc/padloc/blob/master/README.md#configuration).
|
||||
For example, if you want the app to connect to the official Padloc server:
|
||||
|
||||
```sh
|
||||
PL_SERVER_URL=https://api.padloc.app npm run build
|
||||
```
|
||||
|
||||
## TODOs
|
||||
|
||||
Initial tests look very promising. Some things that still need figuring out.
|
||||
|
||||
- [ ] **Persistent Storage**: Using IndexedDB doesn't work here for various reasons. Best option is
|
||||
probably writing a simple storage backend using Tauri's [file system api](https://tauri.studio/docs/api/js#file-system).
|
||||
- [ ] **Copy & Paste**: Doesn't work out of the box. Figure out steps to make it work.
|
||||
- [ ] **Auto-updating**: Must-have feature for desktop apps at least those not distributed through app stores or package managers. Not available in Tauri yet, but apparently on the roadmap.
|
||||
- [ ] **Code-signing**: Also on Tauri's roadmap, but not available yet
|
||||
- [ ] **Run without the embedded web server**: Would be the safer choice security-wise but doesn't seem to work as-is. Need to figure out what changes are needed to make it work.
|
||||
- [ ] **Mobile**: Waiting for Tauri to support Android and iOS builds, which could potentially replace Cordova.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "@padloc/tauri",
|
||||
"version": "3.1.1",
|
||||
"description": "Tauri Wrapper for packaging native apps",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@padloc/app": "^3.1.1",
|
||||
"@padloc/core": "^3.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tauri": "^0.6.2",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"css-loader": "^3.0.0",
|
||||
"file-loader": "^4.0.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"style-loader": "^1.0.0",
|
||||
"ts-loader": "^6.0.4",
|
||||
"ts-node": "^7.0.1",
|
||||
"typescript": "^3.5.2",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.5",
|
||||
"webpack-dev-server": "^3.7.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack && tauri build",
|
||||
"dev": "webpack-dev-server & tauri dev"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
tauri.js
|
||||
config.json
|
||||
bundle.json
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
[package]
|
||||
name = "Padloc"
|
||||
version = "3.1.1"
|
||||
description = "A modern, open source password manager for individuals and teams."
|
||||
authors = [ "martin@maklesoft.com" ]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "Padloc"
|
||||
edition = "2018"
|
||||
build = "src/build.rs"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
tauri = { version = "0.5", features = [ "all-api", "edge" ] }
|
||||
|
||||
[target."cfg(windows)".build-dependencies]
|
||||
winres = "0.1"
|
||||
|
||||
[features]
|
||||
embedded-server = [ "tauri/embedded-server" ]
|
||||
no-server = [ "tauri/no-server" ]
|
||||
|
||||
[[bin]]
|
||||
name = "Padloc"
|
||||
path = "src/main.rs"
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
Binary file not shown.
After Width: | Height: | Size: 73 KiB |
|
@ -0,0 +1,13 @@
|
|||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2018"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
|
@ -0,0 +1,16 @@
|
|||
#[cfg(windows)]
|
||||
extern crate winres;
|
||||
|
||||
#[cfg(windows)]
|
||||
fn main() {
|
||||
if std::path::Path::new("icons/icon.ico").exists() {
|
||||
let mut res = winres::WindowsResource::new();
|
||||
res.set_icon("icons/icon.ico");
|
||||
res.compile().expect("Unable to find visual studio tools");
|
||||
} else {
|
||||
panic!("No Icon.ico found. Please add one or check the path");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn main() {}
|
|
@ -0,0 +1,10 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "cmd", rename_all = "camelCase")]
|
||||
pub enum Cmd {
|
||||
// your custom commands
|
||||
// multiple arguments are allowed
|
||||
// note that rename_all = "camelCase": you need to use "myCustomCommand" on JS
|
||||
MyCustomCommand { argument: String },
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
mod cmd;
|
||||
|
||||
fn main() {
|
||||
tauri::AppBuilder::new()
|
||||
.invoke_handler(|_webview, arg| {
|
||||
use cmd::Cmd::*;
|
||||
match serde_json::from_str(arg) {
|
||||
Err(e) => {
|
||||
Err(e.to_string())
|
||||
}
|
||||
Ok(command) => {
|
||||
match command {
|
||||
// definitions for your custom commands from Cmd here
|
||||
MyCustomCommand { argument } => {
|
||||
// your command code
|
||||
println!("{}", argument);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.run();
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
"devPath": "http://localhost:8080",
|
||||
"beforeDevCommand": "",
|
||||
"beforeBuildCommand": ""
|
||||
},
|
||||
"ctx": {},
|
||||
"tauri": {
|
||||
"embeddedServer": {
|
||||
"active": true
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "app.padloc",
|
||||
"icon": [
|
||||
"icons/icon.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "",
|
||||
"category": "Utility",
|
||||
"shortDescription": "Padloc",
|
||||
"longDescription": "A modern, open source password manager for individuals and teams.",
|
||||
"deb": {
|
||||
"depends": [],
|
||||
"useBootstrapper": false
|
||||
},
|
||||
"osx": {
|
||||
"frameworks": [],
|
||||
"minimumSystemVersion": "",
|
||||
"useBootstrapper": false
|
||||
},
|
||||
"exceptionDomain": ""
|
||||
},
|
||||
"whitelist": {
|
||||
"all": true
|
||||
},
|
||||
"window": {
|
||||
"title": "Padloc",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"resizable": true,
|
||||
"fullscreen": false
|
||||
},
|
||||
"security": {
|
||||
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"
|
||||
},
|
||||
"edge": {
|
||||
"active": true
|
||||
},
|
||||
"inliner": {
|
||||
"active": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Padloc</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
||||
/>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
background: linear-gradient(rgb(89, 198, 255), rgb(7, 124, 185));
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overscroll-behavior: none;
|
||||
color: #fff;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
stroke-dashoffset: 240;
|
||||
}
|
||||
|
||||
to {
|
||||
stroke-dashoffset: 40;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.spinner circle {
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-linecap: round;
|
||||
stroke-width: 10;
|
||||
stroke-dasharray: 252;
|
||||
transform-origin: center center;
|
||||
will-change: transform;
|
||||
animation: spin 1.5s cubic-bezier(0.44, 0.22, 0.64, 0.86) alternate infinite,
|
||||
rotate linear 1.2s infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<svg viewBox="0 0 100 100" class="spinner">
|
||||
<circle cx="50" cy="50" r="40" />
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
import { setPlatform } from "@padloc/core/src/platform";
|
||||
import { TauriPlatform } from "./platform";
|
||||
|
||||
(async () => {
|
||||
setPlatform(new TauriPlatform());
|
||||
|
||||
await import("@padloc/app/src/elements/app");
|
||||
|
||||
window.onload = () => {
|
||||
const app = document.createElement("pl-app");
|
||||
document.body.appendChild(app);
|
||||
};
|
||||
})();
|
|
@ -0,0 +1,6 @@
|
|||
import { WebPlatform } from "@padloc/app/src/lib/platform";
|
||||
import { MemoryStorage } from "@padloc/core/src/storage";
|
||||
|
||||
export class TauriPlatform extends WebPlatform {
|
||||
storage = new MemoryStorage();
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../app/tsconfig.json"
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
const path = require("path");
|
||||
const { EnvironmentPlugin } = require("webpack");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||
const { version } = require("./package.json");
|
||||
|
||||
const out = process.env.PL_PWA_DIR || path.resolve(__dirname, "dist");
|
||||
const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_SERVER_PORT || 3000}`;
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, "src/index.ts"),
|
||||
output: {
|
||||
path: out,
|
||||
filename: "[name].js",
|
||||
chunkFilename: "[name].chunk.js",
|
||||
publicPath: "/"
|
||||
},
|
||||
mode: "development",
|
||||
devtool: "source-map",
|
||||
stats: "minimal",
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: "ts-loader"
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ["style-loader", "css-loader"]
|
||||
},
|
||||
{
|
||||
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
|
||||
use: ["file-loader"]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new EnvironmentPlugin({
|
||||
PL_SERVER_URL: serverUrl,
|
||||
PL_BILLING_ENABLED: null,
|
||||
PL_BILLING_DISABLE_PAYMENT: null,
|
||||
PL_BILLING_STRIPE_PUBLIC_KEY: null,
|
||||
PL_SUPPORT_EMAIL: "support@padloc.app",
|
||||
PL_VERSION: version,
|
||||
PL_DISABLE_SW: true
|
||||
}),
|
||||
new CleanWebpackPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
title: "Padloc",
|
||||
template: path.resolve(__dirname, "src/index.html")
|
||||
})
|
||||
],
|
||||
devServer: {
|
||||
contentBase: path.resolve(__dirname, "dist"),
|
||||
historyApiFallback: true,
|
||||
host: "0.0.0.0",
|
||||
port: process.env.PL_PWA_PORT || 8080
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue