Skip to content

Commit feb6f94

Browse files
authored
Merge pull request #597 from MerginMaps/fix-badges-visual
Fix badges visual
2 parents 50de851 + e618705 commit feb6f94

File tree

7 files changed

+78
-114
lines changed

7 files changed

+78
-114
lines changed
Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<template>
2-
<div>
3-
<div class="type-badge ce" v-if="type === 'CE'" >Community Edition</div>
4-
<div class="type-badge ee" v-else-if="type === 'EE'">Enterprise Edition</div>
5-
</div>
2+
<span>
3+
<VPBadge v-if="type === 'CE'" text="Community Edition" type="warning"/>
4+
<VPBadge v-else-if="type === 'EE'" text="Enterprise Edition" type="warning"/>
5+
</span>
66
</template>
77

8-
98
<script>
9+
import { VPBadge } from "vitepress/theme";
10+
1011
export default {
1112
name: "migration-type",
1213
props: {
@@ -17,23 +18,4 @@ export default {
1718

1819
<style scoped>
1920
20-
.type-badge {
21-
display: inline-block;
22-
height: 18px;
23-
line-height: 18px;
24-
white-space: nowrap;
25-
border-radius: 3px;
26-
padding: 0 6px;
27-
color: white;
28-
}
29-
30-
.ce {
31-
background-color: var(--mm-badge-ce-bg);;
32-
}
33-
34-
.ee {
35-
background-color: var(--mm-badge-ee-bg);;
36-
}
37-
3821
</style>
39-
Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<template>
22
<span>
3-
<span class="servertype servertype-ce" v-if="type === 'CE'" >Community Edition only</span>
4-
<span class="servertype servertype-ee" v-else-if="type === 'EE'">Enterprise Edition only</span>
3+
<VPBadge v-if="type === 'CE'" text="Community Edition only" type="warning"/>
4+
<VPBadge v-else-if="type === 'EE'" text="Enterprise Edition only" type="warning"/>
55
</span>
66
</template>
77

88

99
<script>
10+
import { VPBadge } from "vitepress/theme";
11+
1012
export default {
1113
name: "servertype",
1214
props: {
@@ -16,22 +18,5 @@ export default {
1618
</script>
1719

1820
<style scoped>
19-
.servertype {
20-
display: inline-block;
21-
line-height: 18px;
22-
white-space: nowrap;
23-
border-radius: 6px;
24-
padding: 0.25em 1em;
25-
color: white;
26-
margin-left: 5px;
27-
}
28-
29-
.servertype-ce {
30-
background-color: var(--mm-badge-ce-bg);
31-
}
3221
33-
.servertype-ee {
34-
background-color: var(--mm-badge-ee-bg);
35-
}
3622
</style>
37-
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<template>
22
<span>
3-
<span class="sincebadge" v-if="type === 'App'" >since Mobile app {{ version }}</span>
4-
<span class="sincebadge" v-else-if="type === 'Plugin'">since QGIS plugin {{ version }}</span>
5-
<span class="sincebadge" v-else-if="type === 'Server'">since Server {{ version }}</span>
3+
<VPBadge v-if="type === 'App'" :text="`Since Mobile app ${version}`" type="tip"/>
4+
<VPBadge v-else-if="type === 'Plugin'" :text="`Since QGIS plugin ${version}`" type="tip"/>
5+
<VPBadge v-else-if="type === 'Server'" :text="`Since Server ${version}`" type="tip"/>
66
</span>
77
</template>
88

99

1010
<script>
11+
import { VPBadge } from "vitepress/theme";
12+
1113
export default {
1214
name: "sincebadge",
1315
props: {
@@ -18,15 +20,5 @@ export default {
1820
</script>
1921

2022
<style scoped>
21-
.sincebadge {
22-
display: inline-block;
23-
line-height: 1;
24-
white-space: nowrap;
25-
border-radius: 6px;
26-
padding: 0.25em 1em;
27-
color: var(--mm-badge-since-text-color);
28-
background-color: var(--mm-badge-since-bg);
29-
margin-left: 5px;
30-
}
31-
</style>
3223
24+
</style>

src/.vitepress/theme/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://vitepress.dev/guide/custom-theme
22
import { h } from "vue";
33
import type { Theme } from "vitepress";
4-
import DefaultTheme from "vitepress/theme";
4+
import DefaultTheme, { VPBadge } from "vitepress/theme";
55
import "./style.css";
66
import imageViewer from "vitepress-plugin-image-viewer";
77
import vImageViewer from "vitepress-plugin-image-viewer/lib/vImageViewer.vue";
@@ -31,6 +31,7 @@ export default {
3131
enhanceApp({ app, router, siteData }) {
3232
DefaultTheme.enhanceApp({ app, router, siteData });
3333
app.component("vImageViewer", vImageViewer);
34+
app.component('VPBadge', VPBadge);
3435
app.use(
3536
createGtm({
3637
id: "GTM-NW7ZGNB", // Your GTM single container ID or array of container ids ['GTM-xxxxxx', 'GTM-yyyyyy'] or array of objects [{id: 'GTM-xxxxxx', queryPararms: { gtm_auth: 'abc123', gtm_preview: 'env-4', gtm_cookies_win: 'x'}}, {id: 'GTM-yyyyyy', queryParams: {gtm_auth: 'abc234', gtm_preview: 'env-5', gtm_cookies_win: 'x'}}]

src/.vitepress/theme/style.css

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,3 @@ img {
157157
align-items: center;
158158
gap: 0.25em;
159159
}
160-
161-
/** Component: ServerType */
162-
:root {
163-
--mm-badge-ee-bg: #FFA6A6;
164-
--mm-badge-ce-bg: #FFB673;
165-
}
166-
167-
/** Component: Since badge */
168-
:root {
169-
--mm-badge-since-bg: var(--vp-c-indigo-soft);
170-
--mm-badge-since-text-color: var(--vp-c-text-1);
171-
}

src/misc/write-docs/index.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ You can use any of supported <GitHubRepo id="markdown-it/markdown-it-emoji/blob/
319319

320320
:tada: :grinning: :rofl: :scream: :heart: :pray: :white_check_mark: :no_entry_sign:
321321

322-
```
323-
:tada: :grinning: :rofl: :scream: :heart: :pray: :white_check_mark: :no_entry_sign:
324-
```
322+
```
323+
:tada: :grinning: :rofl: :scream: :heart: :pray: :white_check_mark: :no_entry_sign:
324+
```
325325

326326

327327
### Labels/badges
@@ -330,39 +330,55 @@ Markdown supports using badges, such as:
330330
<Badge text="tip badge" type="tip"/>
331331

332332

333-
```<Badge text="tip badge" type="tip"/>```
333+
```markdown
334+
<Badge text="tip badge" type="tip"/>
335+
```
334336

335337
---
336338

337339
<Badge text="warning badge" type="warning"/>
338340

339341

340-
```<Badge text="warning badge" type="warning"/>```
342+
```markdown
343+
<Badge text="warning badge" type="warning"/>
344+
```
341345

342346
---
343347

344348
<Badge text="error badge" type="danger"/>
345349

346350

347-
```<Badge text="error badge" type="danger"/>```
351+
```markdown
352+
<Badge text="error badge" type="danger"/>
353+
```
348354

349355
For mentioning that some feature is available from specific version, use `<SinceBadge />`
350356

351-
```<SinceBadge type="App" version="2022.1.1" />```
357+
```markdown
358+
<SinceBadge type="App" version="2022.1.1" />
359+
```
352360
<SinceBadge version="2022.1.1" type="App" />
353361

354-
```<SinceBadge type="Plugin" version="2023.2" />```
362+
```markdown
363+
<SinceBadge type="Plugin" version="2023.2" />
364+
```
355365
<SinceBadge version="2023.2" type="Plugin" />
356366

357-
```<SinceBadge type="Server" version="2024.3" />```
367+
```markdown
368+
<SinceBadge type="Server" version="2024.3" />
369+
```
358370
<SinceBadge version="2024.3" type="Server" />
359371

360372
To refer to <EnterprisePlatformName /> or <CommunityPlatformName /> edition, use `<ServerType />`
361373

362-
```<ServerType type="CE" />```
374+
```markdown
375+
<ServerType type="CE" />
376+
```
363377
<ServerType type="CE" />
364378

365-
```<ServerType type="EE" />```
379+
```markdown
380+
<ServerType type="EE" />
381+
```
366382
<ServerType type="EE" />
367383

368384

src/server/security/index.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ We provide a template configuration file <GitHubRepo id="MerginMaps/server/blob/
1313
Let's have a quick look at the main sections:
1414

1515
``` shell
16-
server {
17-
listen 443 ssl;
18-
server_name merginmaps.company.com; # FIXME
19-
client_max_body_size 4G;
20-
...
16+
server {
17+
listen 443 ssl;
18+
server_name merginmaps.company.com; # FIXME
19+
client_max_body_size 4G;
20+
...
2121
```
2222
2323
Here we enable SSL via the default `443` port and configure name-based HTTPS server via `server_name`. Here you should change this according to your target server name.
@@ -27,39 +27,39 @@ We don't recommend setting a `client_max_body_size` higher than specified, becau
2727
Next, you need to point your certificate files to NGINX configuration. This is done on the next lines on the secured configuration:
2828
2929
``` shell
30-
...
31-
ssl_certificate_key /etc/letsencrypt/live/merginmaps.company.com/privkey.pem; # FIXME
32-
ssl_certificate /etc/letsencrypt/live/merginmaps.company.com/fullchain.pem; # FIXME
33-
...
30+
...
31+
ssl_certificate_key /etc/letsencrypt/live/merginmaps.company.com/privkey.pem; # FIXME
32+
ssl_certificate /etc/letsencrypt/live/merginmaps.company.com/fullchain.pem; # FIXME
33+
...
3434
```
3535
3636
The above example uses automated keys generated by CertBot. For more information, visit [CertBot](https://certbot.eff.org/instructions) website and check how you can generate your own keys.
3737
3838
Some extra security settings for HTTP headers are provided. Please review them and update in accordance to your requirements.
3939
4040
```shell
41-
# Prevent crawlers from indexing and following links for all content served from the mergin app
42-
add_header X-Robots-Tag "none";
43-
44-
# Protect against clickjacking iframe
45-
add_header Content-Security-Policy "frame-ancestors 'self';" always;
46-
47-
# Add a HSTS policy to prevent plain http from browser
48-
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
49-
50-
# Set cookies security flags
51-
proxy_cookie_flags ~ secure httponly samesite=strict;
52-
53-
location / {
54-
root /var/www/html;
55-
56-
# The lines below were copied from application proxy
57-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58-
proxy_set_header X-Forwarded-Proto $scheme;
59-
proxy_set_header Host $http_host;
60-
# we don't want nginx trying to do something clever with
61-
# redirects, we set the Host: header above already.
62-
proxy_redirect off;
63-
proxy_pass http://app_server;
64-
}
41+
# Prevent crawlers from indexing and following links for all content served from the mergin app
42+
add_header X-Robots-Tag "none";
43+
44+
# Protect against clickjacking iframe
45+
add_header Content-Security-Policy "frame-ancestors 'self';" always;
46+
47+
# Add a HSTS policy to prevent plain http from browser
48+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
49+
50+
# Set cookies security flags
51+
proxy_cookie_flags ~ secure httponly samesite=strict;
52+
53+
location / {
54+
root /var/www/html;
55+
56+
# The lines below were copied from application proxy
57+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58+
proxy_set_header X-Forwarded-Proto $scheme;
59+
proxy_set_header Host $http_host;
60+
# we don't want nginx trying to do something clever with
61+
# redirects, we set the Host: header above already.
62+
proxy_redirect off;
63+
proxy_pass http://app_server;
64+
}
6565
```

0 commit comments

Comments
 (0)