Skip to content

Commit 89d4088

Browse files
Web next wip (#170)
* init repo * fonts, css configuration basis * icons defs * components update * home page mvp ready * password reset start / send * correct icon size * reset password form page * make proxy use webnext * fix pnpm workflow version * Update Dockerfile * merge gitignore * Update PasswordStartPage.tsx * add assets compression on build * bump ammonia crate
1 parent 818389d commit 89d4088

File tree

156 files changed

+10279
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+10279
-29
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
target/
22
web/node_modules
33
web/dist
4+
webnext/node_modules
5+
webnext/dist
46
.volumes/
57
.github/
68
docs/

.github/workflows/lint-web.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
with:
3333
node-version: 24
3434
- name: install deps
35-
working-directory: ./web
35+
working-directory: ./webnext
3636
run: |
3737
npm i -g pnpm
3838
pnpm i --frozen-lockfile
3939
- name: Lint
40-
working-directory: ./web
40+
working-directory: ./webnext
4141
run: pnpm lint
4242
- name: Audit
43-
working-directory: ./web
43+
working-directory: ./webnext
4444
run: pnpm audit --prod

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,20 @@ jobs:
111111
with:
112112
version: 10
113113

114-
- name: Use Node.js 24
114+
- name: Use Node.js
115115
uses: actions/setup-node@v4
116116
with:
117117
node-version: 24
118+
cache: "pnpm"
119+
cache-dependency-path: ./webnext/pnpm-lock.yaml
118120

119121
- name: Install frontend dependencies
120122
run: pnpm install --ignore-scripts --frozen-lockfile
121-
working-directory: web
123+
working-directory: webnext
122124

123125
- name: Build frontend
124126
run: pnpm build
125-
working-directory: web
127+
working-directory: webnext
126128

127129
- name: Build release binary
128130
uses: actions-rs/cargo@v1

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
FROM node:24-alpine AS web
22

33
WORKDIR /app
4-
COPY web/package.json .
5-
COPY web/pnpm-lock.yaml .
6-
COPY web/.npmrc .
4+
COPY webnext/package.json webnext/pnpm-lock.yaml webnext/.npmrc ./
75
RUN npm i -g pnpm
86
RUN pnpm install --ignore-scripts --frozen-lockfile
9-
COPY web/ .
7+
COPY webnext/ .
108
RUN pnpm run generate-translation-types
119
RUN pnpm build
1210

@@ -31,8 +29,7 @@ COPY --from=planner /build/recipe.json recipe.json
3129
RUN cargo chef cook --release --recipe-path recipe.json
3230

3331
# build project
34-
COPY --from=web /app/dist ./web/dist
35-
COPY web/src/shared/images/svg ./web/src/shared/images/svg
32+
COPY --from=web /app/dist ./webnext/dist
3633
RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev
3734
COPY Cargo.toml Cargo.lock build.rs ./
3835
# for vergen

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,30 @@ Find us on Matrix: [#defguard:teonite.com](https://matrix.to/#/#defguard:teonite
2323

2424
Please review the [Contributing guide](https://defguard.gitbook.io/defguard/for-developers/contributing) for information on how to get started contributing to the project. You might also find our [environment setup guide](https://defguard.gitbook.io/defguard/for-developers/dev-env-setup) handy.
2525

26-
2726
## Development
2827

2928
Clone repository:
29+
3030
```bash
3131
git@github.com:DefGuard/client.git
3232
```
3333

3434
Initialize `proto` submodule:
35+
3536
```bash
3637
git submodule update --init --recursive
3738
```
3839

3940
To run API server:
41+
4042
```bash
4143
cargo run
4244
```
4345

4446
To run webapp dev server:
47+
4548
```bash
46-
cd web/
49+
cd webnext/
4750
pnpm install
4851
pnpm run dev
4952
```
@@ -76,5 +79,3 @@ All release assets (binaries, packages, etc.) include SHA256 checksums that are
7679
# Linux/macOS
7780
echo known_sha256_checksum_of_the_file path/to/file | sha256sum --check
7881
```
79-
80-

src/assets.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,9 @@ pub async fn index() -> impl IntoResponse {
1515
web_asset(Uri::from_static("/index.html")).await
1616
}
1717

18-
pub async fn svg(uri: Uri) -> impl IntoResponse {
19-
let mut path = uri.path().trim_start_matches('/').to_string();
20-
// Rewrite the path to match the structure of the embedded files
21-
path.insert_str(0, "src/shared/images/");
22-
StaticFile(path)
23-
}
24-
2518
#[derive(Embed)]
26-
#[folder = "web/"]
19+
#[folder = "webnext/"]
2720
#[include = "dist/*"]
28-
#[include = "src/shared/images/*"]
2921
struct WebAsset;
3022

3123
pub struct StaticFile<T>(pub T);

src/http.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use tracing::{info_span, Level};
3333
use url::Url;
3434

3535
use crate::{
36-
assets::{index, svg, web_asset},
36+
assets::{index, web_asset},
3737
config::Config,
3838
enterprise::handlers::openid_login::{self, FlowType},
3939
error::ApiError,
@@ -265,7 +265,6 @@ pub async fn run_server(config: Config) -> anyhow::Result<()> {
265265
.route("/{*path}", get(index))
266266
.route("/fonts/{*path}", get(web_asset))
267267
.route("/assets/{*path}", get(web_asset))
268-
.route("/svg/{*path}", get(svg))
269268
.nest(
270269
"/api/v1",
271270
Router::new()

webnext/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = false
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.{ts,tsx,js,jsx,scss,html,json,yaml}]
11+
rulers = 90

webnext/.gitattributes

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
* text=auto eol=lf
2+
3+
*.js text eol=lf
4+
*.jsx text eol=lf
5+
*.ts text eol=lf
6+
*.tsx text eol=lf
7+
*.css text eol=lf
8+
*.scss text eol=lf
9+
*.json text eol=lf
10+
*.html text eol=lf
11+
*.md text eol=lf
12+
*.yml text eol=lf
13+
*.yaml text eol=lf
14+
*.lock text eol=lf
15+
16+
*.woff binary
17+
*.woff2 binary
18+
*.ttf binary
19+
*.otf binary
20+
*.eot binary
21+
*.png binary
22+
*.jpg binary
23+
*.jpeg binary
24+
*.gif binary
25+
*.webp binary
26+
*.avif binary
27+
*.ico binary
28+
*.mp4 binary
29+
*.webm binary
30+
*.ogg binary
31+
*.mp3 binary
32+
*.wav binary
33+
*.pdf binary
34+
*.zip binary
35+
*.tar binary
36+
*.gz binary

0 commit comments

Comments
 (0)