Skip to content

Commit 09372fd

Browse files
committed
fix file formating
1 parent 12cbc6e commit 09372fd

File tree

5 files changed

+94
-64
lines changed

5 files changed

+94
-64
lines changed

backend/src/services/file.service.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
ConflictException,
1919
Injectable,
2020
NotFoundException,
21-
OnModuleInit, UnsupportedMediaTypeException,
21+
OnModuleInit,
22+
UnsupportedMediaTypeException,
2223
} from '@nestjs/common';
2324
import { InjectRepository } from '@nestjs/typeorm';
2425
import jwt from 'jsonwebtoken';
@@ -792,7 +793,10 @@ export class FileService implements OnModuleInit {
792793

793794
logger.debug(`Creating temporary access for file: ${filename}`);
794795

795-
const fileExtensionToFileTypeMap: ReadonlyMap<string, FileType> = new Map([
796+
const fileExtensionToFileTypeMap: ReadonlyMap<
797+
string,
798+
FileType
799+
> = new Map([
796800
['.bag', FileType.BAG],
797801
['.mcap', FileType.MCAP],
798802
['.yaml', FileType.YAML],
@@ -801,17 +805,28 @@ export class FileService implements OnModuleInit {
801805
['.db3', FileType.DB3],
802806
]);
803807

804-
const supported_file_endings = [...fileExtensionToFileTypeMap.keys()];
808+
const supported_file_endings = [
809+
...fileExtensionToFileTypeMap.keys(),
810+
];
805811

806-
if (!supported_file_endings.some((ending) => filename.endsWith(ending))) {
812+
if (
813+
!supported_file_endings.some((ending) =>
814+
filename.endsWith(ending),
815+
)
816+
) {
807817
emptyCredentials.error = 'Invalid file ending';
808818
return emptyCredentials;
809819
}
810820

811-
const matchingFileType = supported_file_endings.find(ending => filename.endsWith(ending));
812-
if (matchingFileType === undefined) throw new UnsupportedMediaTypeException();
813-
const fileType: FileType | undefined = fileExtensionToFileTypeMap.get(matchingFileType);
814-
if (fileType === undefined) throw new UnsupportedMediaTypeException();
821+
const matchingFileType = supported_file_endings.find((ending) =>
822+
filename.endsWith(ending),
823+
);
824+
if (matchingFileType === undefined)
825+
throw new UnsupportedMediaTypeException();
826+
const fileType: FileType | undefined =
827+
fileExtensionToFileTypeMap.get(matchingFileType);
828+
if (fileType === undefined)
829+
throw new UnsupportedMediaTypeException();
815830

816831
// check if file already exists
817832
const existingFile = await this.fileRepository.exists({

dev-oauth/templates/login.html

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,61 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Fake OAuth2 Login</title>
7-
<link
8-
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
9-
rel="stylesheet"
10-
/>
11-
</head>
12-
<body class="bg-light">
13-
<div class="container mt-5">
14-
<h2 class="mb-4 text-center">Select a user to log into Kleinkram</h2>
15-
<form method="POST" action="/login">
16-
<input type="hidden" name="redirect_uri" value="{{ redirect_uri }}" />
17-
<!-- Added hidden input for state parameter -->
18-
{% if state %}
19-
<input type="hidden" name="state" value="{{ state }}" />
20-
{% endif %}
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Fake OAuth2 Login</title>
7+
<link
8+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
9+
rel="stylesheet"
10+
/>
11+
</head>
12+
<body class="bg-light">
13+
<div class="container mt-5">
14+
<h2 class="mb-4 text-center">
15+
Select a user to log into Kleinkram
16+
</h2>
17+
<form method="POST" action="/login">
18+
<input
19+
type="hidden"
20+
name="redirect_uri"
21+
value="{{ redirect_uri }}"
22+
/>
23+
<!-- Added hidden input for state parameter -->
24+
{% if state %}
25+
<input type="hidden" name="state" value="{{ state }}" />
26+
{% endif %}
2127

22-
<div class="row justify-content-center">
23-
<div class="col-md-6">
24-
{% for user in users %}
25-
<div class="card mb-3 shadow-xs">
26-
<div class="card-body d-flex justify-content-between align-items-center">
27-
<div>
28-
<h5 class="card-title mb-1">
29-
{{ user.displayName }}
30-
</h5>
31-
<p class="card-text text-muted">{{ user.comment }}</p>
28+
<div class="row justify-content-center">
29+
<div class="col-md-6">
30+
{% for user in users %}
31+
<div class="card mb-3 shadow-xs">
32+
<div
33+
class="card-body d-flex justify-content-between align-items-center"
34+
>
35+
<div>
36+
<h5 class="card-title mb-1">
37+
{{ user.displayName }}
38+
</h5>
39+
<p class="card-text text-muted">
40+
{{ user.comment }}
41+
</p>
42+
</div>
43+
<button
44+
type="submit"
45+
class="btn btn-primary"
46+
name="user_id"
47+
value="{{ user.id }}"
48+
>
49+
Login
50+
</button>
51+
</div>
3252
</div>
33-
<button type="submit" class="btn btn-primary" name="user_id" value="{{ user.id }}">
34-
Login
35-
</button>
53+
{% endfor %}
3654
</div>
3755
</div>
38-
{% endfor %}
39-
</div>
56+
</form>
4057
</div>
41-
</form>
42-
</div>
4358

44-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
45-
</body>
46-
</html>
59+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
60+
</body>
61+
</html>

docs/development/api/Introduction.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ same version as the backend is running.
2525

2626
The latter allows us to display depreciation warnings for outdated client packages.
2727

28-
Example:
28+
Example:
2929

3030
```bash
3131
curl 'http://localhost:3000/user/me' \
@@ -34,5 +34,4 @@ curl 'http://localhost:3000/user/me' \
3434
-b 'authtoken=...; refreshtoken=...'
3535
```
3636

37-
38-
:::
37+
:::

docs/development/getting-started.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,25 @@ In principle the setup works similar to running the project locally, however, th
5353
1. Clone the repository
5454
2. Run the following command to start the development server
5555

56-
```bash
57-
docker compose up --build --watch
58-
```
56+
```bash
57+
docker compose up --build --watch
58+
```
5959

6060
::: tip
61+
6162
- the `--build` flag is used to build the project before starting the development server.
6263
- the `--watch` flag is optional and is used to watch for changes in the codebase.
63-
:::
64+
:::
6465

6566
3. You can now open the projects:
6667
- frontend at [http://localhost:8003](http://localhost:8003).
6768
- minio console at [http://localhost:9001](http://localhost:9001).
6869
- documentation at [http://localhost:4000](http://localhost:4000).
6970

70-
::: warning
71-
There are some known issues with Safari while developing locally. Please use Chrome or Firefox instead.
72-
The production build does support Safari.
73-
:::
71+
::: warning
72+
There are some known issues with Safari while developing locally. Please use Chrome or Firefox instead.
73+
The production build does support Safari.
74+
:::
7475

7576
4. In order to enable code completion and linting in your IDE, you may need to install additional tools.
7677
- For JavaScript/TypeScript, you may need to install NodeJS and yarn.
@@ -90,14 +91,13 @@ machine. This is necessary for code completion and linting in your IDE.
9091

9192
6. For installing the cli, you can use the following command:
9293

93-
```bash
94-
cd kleinkram/cli
95-
96-
virtualenv -ppython3.8 .venv
97-
source .venv/bin/activate
98-
pip install -e . -r requirements.txt
99-
```
94+
```bash
95+
cd kleinkram/cli
10096
97+
virtualenv -ppython3.8 .venv
98+
source .venv/bin/activate
99+
pip install -e . -r requirements.txt
100+
```
101101

102102
### Enable Database Seeding
103103

docs/usage/python/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ klein login --key $APIKEY
7878
7979
- [using the CLI](./cli.md)
8080
- [using the python package](./package.md)
81+
```

0 commit comments

Comments
 (0)