merge PR #27 into master
commit
ce2aeb326f
@ -0,0 +1,36 @@ |
||||
# Use rust's latest alpine image as base image. |
||||
FROM rust:alpine |
||||
|
||||
ENV LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH |
||||
|
||||
RUN apk add git nodejs npm llvm-static llvm-dev clang-static clang-dev openssl openssl-dev perl gtk+3.0-dev webkit2gtk-dev librsvg-dev curl wget pkgconf eudev-dev build-base zlib-static bzip2-static build-base ncursers-static && \ |
||||
# Install Rust and Node.js tools |
||||
cargo install cargo-watch && \ |
||||
cargo install wasm-pack --git https://github.com/rustwasm/wasm-pack.git --rev c2b663f25abe50631a236d57a8c6d7fd806413b2 && \ |
||||
cargo install tauri-cli --version "2.0.0-alpha.11" --locked && \ |
||||
npm install -g pnpm |
||||
|
||||
# Clone the nextgraph-rs repository |
||||
RUN git clone https://git.nextgraph.org/NextGraph/nextgraph-rs.git && \ |
||||
cd /nextgraph-rs/ng-sdk-js && \ |
||||
wasm-pack build --target bundler && npm install --no-save pkg && |
||||
# Build ng-app web version |
||||
cd /nextgraph-rs/ng-app && pnpm install && pnpm webfilebuild |
||||
|
||||
# From here the build fails due to llvm / clang linking issues... |
||||
# |
||||
# WORKDIR /nextgraph-rs |
||||
## Build the nextgraph-rs project and its subprojects |
||||
# RUN cd /nextgraph-rs && git pull && cargo update -p ng-rocksdb && \ |
||||
# cargo build -r && \ |
||||
# cargo build -r -p ngd && \ |
||||
# cargo build -r -p ngcli |
||||
|
||||
# TODO: Build the platform-specific ng-app versions |
||||
# cd /nextgraph-rs/ng-app && cargo tauri build --target x86_64-unknown-linux-gnu |
||||
# ... |
||||
|
||||
# TODO: To remove the image size, remove ~/.cargo, ~/.rustup, and the build dependencies |
||||
|
||||
# To build the image, run: |
||||
# docker build -t nextgraph-rs:alpine -f docker/Dockerfile.alpine . |
@ -0,0 +1,46 @@ |
||||
# Use fedora:40 as base image |
||||
FROM fedora:40 |
||||
|
||||
# Set the environment variable to ensure cargo is available in the PATH |
||||
ENV PATH="/root/.cargo/bin:${PATH}" |
||||
SHELL ["/bin/bash", "-c"] |
||||
|
||||
# Install the required packages and Rust |
||||
|
||||
RUN dnf install -y git clang-devel webkit2gtk4.1-devel openssl openssl-devel curl wget file libappindicator-gtk3-devel librsvg2-devel perl && \ |
||||
dnf group install -y "C Development Tools and Libraries" && \ |
||||
# Rust |
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \ |
||||
# Node.js |
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \ |
||||
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ |
||||
nvm install 22 && \ |
||||
npm install -g pnpm && \ |
||||
# Clear Cache |
||||
rm -rf /var/cache/dnf && \ |
||||
# Install Rust and Node.js tools |
||||
cargo install cargo-watch && \ |
||||
cargo install wasm-pack --git https://github.com/rustwasm/wasm-pack.git --rev c2b663f25abe50631a236d57a8c6d7fd806413b2 && \ |
||||
cargo install tauri-cli --version "2.0.0-alpha.11" --locked && \ |
||||
# Clone the nextgraph-rs repository (TODO: It might be better to put this into a seperate RUN command to avoid rebuilding the image if the repository changes) |
||||
git clone https://git.nextgraph.org/NextGraph/nextgraph-rs.git && \ |
||||
# Build sdk and ng-app web version |
||||
cd /nextgraph-rs/ng-sdk-js && wasm-pack build --target bundler && npm install --no-save pkg && \ |
||||
cd /nextgraph-rs/ng-app && pnpm install && pnpm webfilebuild |
||||
|
||||
# Build the nextgraph-rs project |
||||
RUN export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ |
||||
cd /nextgraph-rs && git pull && cargo update -p ng-rocksdb && \ |
||||
cargo build -r && \ |
||||
cargo build -r -p ngd && \ |
||||
cargo build -r -p ngcli |
||||
|
||||
|
||||
# TODO: Build the platform-specific ng-app versions |
||||
# cd /nextgraph-rs/ng-app && cargo tauri build --target x86_64-unknown-linux-gnu |
||||
# ... |
||||
|
||||
# TODO: To remove the image size, remove ~/.cargo, ~/.rustup, and the build dependencies |
||||
|
||||
# To build the image, run: |
||||
# docker build -t nextgraph-rs:fedora -f docker/Dockerfile.fedora . |
@ -0,0 +1,47 @@ |
||||
# Use ubuntu 22.04 as base image |
||||
FROM ubuntu:22.04 |
||||
|
||||
SHELL ["/bin/bash", "-c"] |
||||
|
||||
# Set the environment variable to ensure cargo is available in the PATH |
||||
ENV PATH="/root/.cargo/bin:${PATH}" |
||||
|
||||
# Install the required packages and Rust |
||||
RUN apt update && \ |
||||
apt upgrade -y && \ |
||||
apt install -y git llvm-dev libclang-dev clang libssl-dev perl libappindicator3-dev libwebkit2gtk-4.0-dev librsvg2-dev curl wget pkg-config libudev-dev build-essential && \ |
||||
rm -rf /var/cache/apt && \ |
||||
# Rust |
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ |
||||
# Node.js |
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \ |
||||
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ |
||||
nvm install 22 && \ |
||||
npm install -g pnpm && \ |
||||
# Install Rust and Node.js tools |
||||
cargo install cargo-watch && \ |
||||
cargo install wasm-pack --git https://github.com/rustwasm/wasm-pack.git --rev c2b663f25abe50631a236d57a8c6d7fd806413b2 && \ |
||||
cargo install tauri-cli --version "2.0.0-alpha.11" --locked && \ |
||||
npm install -g pnpm && \ |
||||
# Clone the nextgraph-rs repository (TODO: It might be better to put this into a seperate RUN command to avoid rebuilding the image if the repository changes) |
||||
git clone https://git.nextgraph.org/NextGraph/nextgraph-rs.git && \ |
||||
# Build sdk and ng-app web version |
||||
cd /nextgraph-rs/ng-sdk-js && wasm-pack build --target bundler && npm install --no-save pkg && \ |
||||
cd /nextgraph-rs/ng-app && \ |
||||
pnpm install && pnpm webfilebuild |
||||
|
||||
# Build the nextgraph-rs project and its subprojects |
||||
WORKDIR /nextgraph-rs |
||||
RUN cargo build -r && \ |
||||
cargo build -r -p ngd && \ |
||||
cargo build -r -p ngcli |
||||
|
||||
|
||||
# TODO: Build the platform-specific ng-app versions |
||||
# WORKDIR /nextgraph-rs/ng-app |
||||
# RUN cargo tauri build --target x86_64-unknown-linux-gnu |
||||
|
||||
# TODO: To remove the image size, remove ~/.cargo, ~/.rustup, and the build dependencies |
||||
|
||||
# To build the image, run: |
||||
# docker build -t nextgraph-rs:ubuntu -f docker/Dockerfile.ubuntu . |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,78 @@ |
||||
<script lang="ts"> |
||||
export let value: string = ""; |
||||
export let id: string; |
||||
|
||||
let has_success: boolean = false; |
||||
|
||||
const tauri_platform = import.meta.env.TAURI_PLATFORM; |
||||
const setClipboard = async (text: string) => { |
||||
if (tauri_platform) { |
||||
// TODO: this won't work for tauri platform. |
||||
// const { writeText } = await import("@tauri-apps/api/clipboard"); |
||||
// await writeText(text); |
||||
} else { |
||||
navigator.clipboard.writeText(text); |
||||
} |
||||
}; |
||||
|
||||
const on_click = (e) => { |
||||
has_success = true; |
||||
setTimeout(() => (has_success = false), 2_000); |
||||
setClipboard(value); |
||||
}; |
||||
</script> |
||||
|
||||
<div class="w-full mt-2"> |
||||
<div class="relative"> |
||||
<textarea |
||||
{id} |
||||
rows="3" |
||||
style="resize: none;" |
||||
{value} |
||||
class="col-span-6 pr-11 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500" |
||||
disabled |
||||
readonly |
||||
/> |
||||
{#if !tauri_platform} |
||||
<button |
||||
on:click={on_click} |
||||
class="absolute inset-y-0 right-0 p-3 flex items-center text-sm leading-5 bg-transparent shadow-none" |
||||
> |
||||
<span id="default-icon" class:hidden={has_success}> |
||||
<svg |
||||
class="w-3.5 h-3.5" |
||||
aria-hidden="true" |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
fill="currentColor" |
||||
viewBox="0 0 18 20" |
||||
> |
||||
<path |
||||
d="M16 1h-3.278A1.992 1.992 0 0 0 11 0H7a1.993 1.993 0 0 0-1.722 1H2a2 2 0 0 0-2 2v15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2Zm-3 14H5a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2Zm0-4H5a1 1 0 0 1 0-2h8a1 1 0 1 1 0 2Zm0-5H5a1 1 0 0 1 0-2h2V2h4v2h2a1 1 0 1 1 0 2Z" |
||||
/> |
||||
</svg> |
||||
</span> |
||||
<span |
||||
id="success-icon" |
||||
class="inline-flex items-center" |
||||
class:hidden={!has_success} |
||||
> |
||||
<svg |
||||
class="w-3.5 h-3.5 text-blue-700 dark:text-blue-500" |
||||
aria-hidden={!has_success} |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
fill="none" |
||||
viewBox="0 0 16 12" |
||||
> |
||||
<path |
||||
stroke="currentColor" |
||||
stroke-linecap="round" |
||||
stroke-linejoin="round" |
||||
stroke-width="2" |
||||
d="M1 5.917 5.724 10.5 15 1.5" |
||||
/> |
||||
</svg> |
||||
</span> |
||||
</button> |
||||
{/if} |
||||
</div> |
||||
</div> |
@ -0,0 +1,40 @@ |
||||
<!-- |
||||
// Copyright (c) 2022-2024 Niko Bonnieure, Par le Peuple, NextGraph.org developers |
||||
// All rights reserved. |
||||
// Licensed under the Apache License, Version 2.0 |
||||
// <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0> |
||||
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, |
||||
// at your option. All files in the project carrying such |
||||
// notice may not be copied, modified, or distributed except |
||||
// according to those terms. |
||||
--> |
||||
|
||||
<!-- |
||||
@component Logo |
||||
The NextGraph Logo svg with color changing between blue and gray, |
||||
depending on connection status: |
||||
- connected: blue |
||||
- connecting: pulse between blue and gray |
||||
- disconnected: gray |
||||
|
||||
Provide classes using the `className` prop. |
||||
--> |
||||
|
||||
<script lang="ts"> |
||||
import { connection_status } from "../../store"; |
||||
// @ts-ignore |
||||
import Logo from "../../assets/nextgraph-nofill.svg?component"; |
||||
|
||||
export let className: string = ""; |
||||
let connection_status_class = "logo-blue"; |
||||
// Color is adjusted to connection status. |
||||
$: if ($connection_status === "connecting") { |
||||
connection_status_class = "logo-pulse"; |
||||
} else if ($connection_status === "disconnected") { |
||||
connection_status_class = "logo-gray"; |
||||
} else { |
||||
connection_status_class = "logo-blue"; |
||||
} |
||||
</script> |
||||
|
||||
<Logo class={`${className} ${connection_status_class}`} /> |
@ -0,0 +1,76 @@ |
||||
<script lang="ts"> |
||||
export let value: string | undefined = undefined; |
||||
export let placeholder: string | undefined = undefined; |
||||
export let className: string | undefined = undefined; |
||||
export let id: string | undefined = undefined; |
||||
export let auto_complete: string | undefined = undefined; |
||||
|
||||
export let show: boolean = false; |
||||
|
||||
let input; |
||||
|
||||
let type: "password" | "text" = "password"; |
||||
$: type = show ? "text" : "password"; |
||||
|
||||
function handleInput(event: Event) { |
||||
const target = event.target as HTMLInputElement; |
||||
value = target.value; |
||||
} |
||||
|
||||
async function toggle() { |
||||
let { selectionStart, selectionEnd } = input; |
||||
show = !show; |
||||
input.focus(); |
||||
setTimeout(function () { |
||||
input.selectionStart = selectionStart; |
||||
input.selectionEnd = selectionEnd; |
||||
}, 0); |
||||
} |
||||
</script> |
||||
|
||||
<div class="relative"> |
||||
<input |
||||
bind:this={input} |
||||
{value} |
||||
{placeholder} |
||||
{id} |
||||
{type} |
||||
on:input={handleInput} |
||||
class={`${className} pr-12 text-md block`} |
||||
autocomplete={auto_complete} |
||||
/> |
||||
|
||||
<div |
||||
class="absolute inset-y-0 right-0 pr-3 flex items-center text-sm leading-5" |
||||
> |
||||
<svg |
||||
fill="none" |
||||
on:click={toggle} |
||||
on:keypress={toggle} |
||||
class={`${show ? "block" : "hidden"} h-6 text-gray-700`} |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
viewbox="0 0 576 512" |
||||
> |
||||
<path |
||||
fill="currentColor" |
||||
d="M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z" |
||||
> |
||||
</path> |
||||
</svg> |
||||
|
||||
<svg |
||||
fill="none" |
||||
class={`${!show ? "block" : "hidden"} h-6 text-gray-700`} |
||||
on:click={toggle} |
||||
on:keypress={toggle} |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
viewbox="0 0 640 512" |
||||
> |
||||
<path |
||||
fill="currentColor" |
||||
d="M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z" |
||||
> |
||||
</path> |
||||
</svg> |
||||
</div> |
||||
</div> |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@ |
||||
NG_ACCOUNT_DOMAIN= |
||||
NG_ACCOUNT_ADMIN= |
||||
NG_ACCOUNT_LOCAL_PEER_KEY= |
||||
NG_ACCOUNT_SERVER=127.0.0.1,1440,[the broker's peer ID] |
||||
RUST_LOG= |
Loading…
Reference in new issue