Skip to content

Commit 43aa958

Browse files
committed
Merge branch 'main' into change-password
2 parents 983d48a + 2d79025 commit 43aa958

File tree

14 files changed

+126
-13
lines changed

14 files changed

+126
-13
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
latest:
2121
description: "Tagger l'image docker avec le tag 'latest' ?"
2222
required: true
23-
default: true
23+
default: false
2424
type: boolean
2525

2626
jobs:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.nuxt/
44
.nitro/
55
.cache/
6+
certificates/
67
dist/
78
node_modules/
89
.DS_Store/

Makefile

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ APPNAME?=sesame-app-manager
44
APP_PORT?=3002
55
PLATFORM?=linux/amd64
66

7+
CERT_DIR = ./certificates
8+
COMMON_NAME = localhost
9+
DAYS_VALID = 365
10+
11+
$(shell mkdir -p $(CERT_DIR))
12+
713
.DEFAULT_GOAL := help
814
help:
915
@printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n"
@@ -24,7 +30,7 @@ dev:
2430
-p $(APP_PORT):3000 \
2531
-p 24678:24678 \
2632
-v $(CURDIR):/data \
27-
$(IMGNAME)
33+
$(IMGNAME) yarn dev
2834

2935
prod:
3036
docker run --rm -it \
@@ -49,3 +55,23 @@ exec:
4955
-e NODE_ENV=development \
5056
-v $(CURDIR):/data \
5157
$(IMGNAME) bash
58+
59+
generate-ssl-cert: ## Générer les certificats HTTPS auto-signés
60+
@echo "Génération des certificats HTTPS auto-signés..."
61+
@openssl req -x509 \
62+
-newkey rsa:4096 \
63+
-keyout $(CERT_DIR)/server.key \
64+
-out $(CERT_DIR)/server.crt \
65+
-days $(DAYS_VALID) \
66+
-nodes \
67+
-subj "/CN=$(COMMON_NAME)"
68+
@chmod 600 $(CERT_DIR)/server.key
69+
@chmod 644 $(CERT_DIR)/server.crt
70+
@echo "Certificats générés avec succès dans $(CERT_DIR)"
71+
72+
clean-ssl-cert: ## Nettoyer les certificats HTTPS
73+
@rm -rf $(CERT_DIR)
74+
@echo "Certificats supprimés"
75+
76+
show-cert-info: ## Afficher les informations du certificat
77+
@openssl x509 -in $(CERT_DIR)/server.crt -text -noout

nuxt.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import pugPlugin from 'vite-plugin-pug'
44
import openapiTS from 'openapi-typescript'
55
import { defineNuxtConfig } from 'nuxt/config'
66
import { parse } from 'yaml'
7+
import consola from 'consola'
78

89
const SESAME_APP_API_URL = process.env.SESAME_APP_API_URL || 'http://localhost:4002'
910

@@ -16,6 +17,19 @@ if (process.env.SESAME_APP_DARK_MODE) {
1617
}
1718
}
1819

20+
let https = {}
21+
if (/yes|1|on|true/i.test(`${process.env.SESAME_HTTPS_ENABLED}`)) {
22+
try {
23+
https = {
24+
key: readFileSync(`${process.env.SESAME_HTTPS_PATH_KEY}`, 'utf8'),
25+
cert: readFileSync(`${process.env.SESAME_HTTPS_PATH_CERT}`, 'utf8'),
26+
};
27+
consola.info('[Nuxt] SSL certificates loaded successfully')
28+
} catch (error) {
29+
consola.warn('[Nuxt] Error while reading SSL certificates', error)
30+
}
31+
}
32+
1933
// https://nuxt.com/docs/api/configuration/nuxt-config
2034
export default defineNuxtConfig({
2135
ssr: false,
@@ -25,6 +39,7 @@ export default defineNuxtConfig({
2539
debug: !!process.env.DEBUG,
2640
devServer: {
2741
port: 3000,
42+
https,
2843
},
2944
devtools: {
3045
enabled: process.env.NODE_ENV === 'development',
@@ -106,6 +121,7 @@ export default defineNuxtConfig({
106121
'/api': {
107122
rewrite: (path: string) => path.replace(/^\/api/, ''),
108123
target: SESAME_APP_API_URL,
124+
secure: false,
109125
changeOrigin: true,
110126
}
111127
},

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@libertech-fr/sesame-app-manager",
3-
"version": "1.1.13",
3+
"version": "1.1.20",
44
"type": "module",
55
"scripts": {
66
"build": "nuxt build",
@@ -20,6 +20,7 @@
2020
"@nuxt-alt/auth": "^3.1.6",
2121
"@nuxt-alt/http": "^1.7.10",
2222
"@nuxt-alt/proxy": "^2.5.8",
23+
"@nyariv/sandboxjs": "^0.8.23",
2324
"@pinia/nuxt": "^0.5.1",
2425
"@quasar/extras": "^1.16.9",
2526
"@vueuse/router": "^10.7.2",

src/assets/sass/global.sass

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ body.body--dark
3030
.sesame-table-td-highlight
3131
color: $primary
3232
font-weight: bold
33+
34+
35+
.outer-ne-resize
36+
resize: vertical
37+
overflow: auto
38+
39+
40+
.inner-ne-resize,
41+
.outer-ne-resize
42+
transform: rotateX(180deg)
43+
height: 100%
44+
width: 100%

src/components/2pan/index.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ q-splitter(
9898
slot(name="right-panel-content-before")
9999
slot(name="right-panel-content-after")
100100
q-expansion-item.bg-blue-grey-10(v-if='debug' label='Debug' icon='mdi-bug' dark dense)
101-
q-card.overflow-auto.bg-blue-grey-8.text-white(:style='{maxHeight: "250px", height: "250px"}')
102-
q-card-section.q-pa-xs
103-
pre.q-ma-none(v-html='JSON.stringify(target, null, 2)')
101+
.outer-ne-resize(:style='{minHeight: "250px", height: "250px"}')
102+
q-card.overflow-auto.bg-blue-grey-8.text-white.inner-ne-resize
103+
q-card-section.q-pa-xs
104+
pre.q-ma-none(v-html='JSON.stringify(target, null, 2)')
104105
</template>
105106

106107
<script lang="ts" setup>
@@ -396,3 +397,6 @@ onMounted(async () => {
396397
}
397398
})
398399
</script>
400+
401+
<style>
402+
</style>

src/components/appbar/RightButtons.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ const badgesValues = ref({
3434
})
3535
3636
const auth = useAuth()
37-
const { debug } = useDebug()
37+
3838
// console.log(auth)
3939
const buttons = [
40-
40+
{
41+
icon: 'mdi-bug',
42+
name: 'Debug',
43+
color: 'warning',
44+
action: toggleDebug,
45+
},
4146
{
4247
icon: 'mdi-logout',
4348
name: 'Déconnexion',
@@ -65,4 +70,16 @@ async function syncAll() {
6570
await identityStateStore.fetchSyncedCount()
6671
}
6772
73+
async function toggleDebug() {
74+
const route = useRoute()
75+
const router = useRouter()
76+
77+
const query = { ...route.query }
78+
query.debug = /true|on|yes|1/i.test(query.debug) ? 0 : 1
79+
80+
await router.replace({
81+
query,
82+
})
83+
}
84+
6885
</script>

src/components/quasar-jsonform/controls/QFileControlRenderer.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ div(style="cursor: pointer")
1919
template(v-slot:prepend)
2020
q-icon(name="mdi-paperclip")
2121
q-card(style="border-radius: 0")
22-
q-img(:src="baseUrl + '/management/identities/photo/raw?' + photoUrlQuery.params" placeholder-src='/no-photo.jpg' fit='contain' height='400px')
22+
q-img(:src="'/api/management/identities/photo/raw?' + photoUrlQuery.params" placeholder-src='/no-photo.jpg' fit='contain' height='400px')
2323
</template>
2424

2525
<script lang="ts">
@@ -80,13 +80,17 @@ const QStringControlRenderer = defineComponent({
8080
return this.control.label === undefined ? this.control.schema.title : this.control.label;
8181
},
8282
photoUrlQuery() {
83+
const auth = useAuth()
8384
const query = new URLSearchParams();
8485
const employeeNumber = (this.jsonforms as any)?.core?.data?.employeeNumber;
8586
const employeeType = (this.jsonforms as any)?.core?.data?.employeeType;
8687
8788
query.append('filters[:inetOrgPerson.employeeNumber]', employeeNumber);
8889
query.append('filters[:inetOrgPerson.employeeType]', employeeType);
8990
91+
if (auth.user?._id) query.append('id', `${auth.user?._id}`);
92+
if (auth.user?.sseToken) query.append('key', `${auth.user?.sseToken}`);
93+
9094
return {
9195
params: query.toString(),
9296
employeeNumber,

src/composables/useColumnsIdentities.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { QTableProps } from 'quasar'
22
import type { components } from '#build/types/service-api'
3+
import Sandbox from '@nyariv/sandboxjs'
34

45
type Identity = components['schemas']['IdentitiesDto']
56

@@ -31,15 +32,23 @@ const daysjs = useDayjs()
3132

3233
function processFieldValue(row: any, field: any) {
3334
if (field.type === 'function') {
34-
return eval(field.value);
35+
const sandbox = new Sandbox();
36+
const exec = sandbox.compile('return ' + field.value, true);
37+
38+
return exec({ row }).run();
3539
}
40+
3641
return row[field];
3742
}
3843

3944
function processFormat(value: any, format: any) {
4045
if (format && format.type === 'function') {
41-
return eval(format.value);
46+
const sandbox = new Sandbox();
47+
const exec = sandbox.compile('return ' + format.value, true);
48+
49+
return exec({ value }).run();
4250
}
51+
4352
return Array.isArray(value) ? value?.join(', ') : value;
4453
}
4554

0 commit comments

Comments
 (0)