fix local build
Deploy app frontend / app frontend (push) Successful in 1m42s
Deploy service couchdb / service couchdb (push) Successful in 31s
Deploy db-migrations / db-migrations (push) Successful in 1m6s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m4s

This commit is contained in:
2024-12-06 11:15:32 +02:00
parent 2146cd8300
commit 7931274680
20 changed files with 96 additions and 25 deletions
@@ -8,6 +8,8 @@ on:
- 'apps/frontend/**'
- '.gitea/workflows/deploy-app-frontend.yaml'
- 'docker-compose.yml'
- 'package.json'
- 'pnpm-lock.yaml'
jobs:
app frontend:
@@ -8,6 +8,8 @@ on:
- 'services/couchdb/**'
- '.gitea/workflows/deploy-service-couchdb.yaml'
- 'docker-compose.yml'
- 'package.json'
- 'pnpm-lock.yaml'
jobs:
service couchdb:
@@ -8,6 +8,8 @@ on:
- 'services/db-migrations/**'
- '.gitea/workflows/deploy-service-db-migrations.yaml'
- 'docker-compose.yml'
- 'package.json'
- 'pnpm-lock.yaml'
jobs:
db-migrations:
@@ -9,6 +9,8 @@ on:
- 'packages/couchdb-changes-stream/**'
- '.gitea/workflows/deploy-service-message-delivery-method-web-push.yaml'
- 'docker-compose.yml'
- 'package.json'
- 'pnpm-lock.yaml'
jobs:
service message-delivery-method-web-push:
@@ -33,7 +35,7 @@ jobs:
- name: build service
run: |
pnpm build -w services/message-delivery-method-web-push
npm -w ./services/message-delivery-method-web-push run build
pnpm --filter ./services/message-delivery-method-web-push deploy --prod build/service-message-delivery-method-web-push
- name: build docker image
+1 -1
View File
@@ -21,6 +21,6 @@ node_modules
*.sln
*.sw?
/couchdb.env
/dev.env
build/
+1
View File
@@ -29,6 +29,7 @@ declare module 'vue' {
ManagePlacementInstructions: typeof import('./src/components/manage/ManagePlacementInstructions.vue')['default']
ProgressSpinner: typeof import('primevue/progressspinner')['default']
QRCodeCard: typeof import('./src/components/manage/QRCodeCard.vue')['default']
QRCodePlacementIcon: typeof import('./src/components/manage/QRCodePlacementIcon.vue')['default']
QueryRender: typeof import('./src/components/QueryRender.vue')['default']
RadioButton: typeof import('primevue/radiobutton')['default']
ReadContactInfo: typeof import('./src/components/read/ReadContactInfo.vue')['default']
+1 -1
View File
@@ -1,4 +1,4 @@
const VER = 14
// const VER = 14
self.addEventListener('message', async (event) => {
event.waitUntil(debug(Object.assign({ answer: true }, event.data)))
@@ -2,7 +2,7 @@
<RouterLink :to="`/manage/qr/${qrCode.uri}/ready`" class="p-4 rounded-lg bg-white shadow-md">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center">
<i :class="['pi', iconClass, 'text-gray-500', 'mr-2']" />
<QRCodePlacementIcon :placement="qrCode.placement" />
<h2 class="text-lg font-semibold">{{ qrCode.name }}</h2>
</div>
<!-- <Button-->
@@ -24,18 +24,6 @@ const props = defineProps<{
qrCode: QRCodeDocument
}>()
const iconClass = computed(() => {
const icons: Record<string, string> = {
car: 'pi-car',
pet: 'pi-paw',
door: 'pi-door-closed',
store: 'pi-shop',
restaurant_table: 'pi-utensils',
other: 'pi-question-circle',
}
return icons[props.qrCode.placement] || 'pi-question-circle'
})
const formatDate = (date: string) => {
// Форматирование даты
const options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric' }
@@ -0,0 +1,22 @@
<template>
<i :class="['pi', iconClass, 'text-gray-500', 'mr-2']" />
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import type { QrCodePlacement } from '@/constants/qrCodePlacements'
const props = defineProps<{ placement: QrCodePlacement }>()
const iconClass = computed(() => {
const icons: Record<string, string> = {
car: 'pi-car',
pet: 'pi-paw',
door: 'pi-door-closed',
store: 'pi-shop',
restaurant_table: 'pi-utensils',
other: 'pi-question-circle',
}
return icons[props.placement] || 'pi-question-circle'
})
</script>
@@ -1,3 +1,7 @@
import { type QRCodeDocument } from '@hereconnect/types'
export type QrCodePlacement = QRCodeDocument['placement']
export const qrCodePlacements = [
{ type: 'car', label: 'Автомобиль' },
{ type: 'pet', label: 'Питомец' },
@@ -5,4 +9,4 @@ export const qrCodePlacements = [
{ type: 'store', label: 'Магазин' },
{ type: 'restaurant_table', label: 'Стол в кафе или ресторане' },
{ type: 'other', label: 'Другое' },
] as const
] as const satisfies { type: QrCodePlacement; label: string }[]
+1 -1
View File
@@ -20,7 +20,7 @@ const routes = [
component: () => import('@/views/CreateView.vue'),
},
{
path: '/manage/dashboard',
path: '/manage',
name: ROUTE_NAMES.MANAGE_DASHBOARD,
component: () => import('@/views/ManageDashboardView.vue'),
props: true,
+4 -2
View File
@@ -4,14 +4,16 @@
"exclude": ["src/**/__tests__/*"],
"files": [
"./components.d.ts",
"./auto-imports.d.ts",
"unplugin-info/client"
"./auto-imports.d.ts"
],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"types": [
"unplugin-info/client"
],
"paths": {
"@/*": ["./src/*"]
}
+3 -1
View File
@@ -16,7 +16,9 @@
},
"scripts": {
"start": "npm run start --workspace=apps/frontend",
"build": "npm run build --workspaces",
"build": "npm run build:deploy:services:message-delivery-method-web-push && npm run build:deploy:services:db-migrations",
"build:deploy:services:message-delivery-method-web-push": "pnpm --filter ./services/message-delivery-method-web-push deploy --prod build/service-message-delivery-method-web-push",
"build:deploy:services:db-migrations": "pnpm --filter ./services/db-migrations deploy --prod build/service-db-migrations",
"test": "npm run test --workspaces",
"lint": "npm run lint --workspaces"
},
@@ -22,6 +22,7 @@
"test": "jest",
"test:watch": "jest --watch",
"prepublishOnly": "npm run build",
"lint": "tsc --noEmit src/CouchDBChangesStream.ts",
"prepare": "npm run build"
},
"keywords": [
+4
View File
@@ -11,6 +11,10 @@
},
"files": ["src/**/*"],
"private": true,
"scripts": {
"lint": "tsc --noEmit src/index.ts",
"build": "pnpm run lint"
},
"peerDependencies": {
"typescript": "~5.6.3",
"@types/web-push": "^3.6.4"
+1 -1
View File
@@ -1,2 +1,2 @@
[chttpd]
require_valid_user = false
require_valid_user = false
+2 -2
View File
@@ -1,7 +1,7 @@
[chttpd]
[_node/_local/chttpd]
enable_cors = true
[cors]
[_node/_local/cors]
headers = accept, authorization, content-type, origin, referer
methods = GET, PUT, POST, HEAD, DELETE
credentials = true
@@ -35,9 +35,10 @@ if (!process.env.API_URL) {
throw new Error("Environment variable API_URL is not set");
}
const urlObject = new URL(process.env.API_URL);
const auth = `${urlObject.username}:${urlObject.password}`;
const headers = {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${urlObject.username}:${urlObject.password}`),
Authorization: "Basic " + btoa(auth),
};
const getUrl = (dbUrlPath) => {
return `${urlObject.protocol}//${urlObject.host}${urlObject.pathname}/${dbUrlPath}${urlObject.search}${urlObject.hash}`;
@@ -78,6 +79,41 @@ export const up = async () => {
);
}
}
const corsConfig = {
"chttpd/enable_cors": "true",
"cors/origins": "*",
"cors/credentials": "true",
"cors/methods": "GET, PUT, POST, HEAD, DELETE",
"cors/headers":
"accept, authorization, content-type, origin, referer, x-csrf-token",
};
const membership = await fetch(getUrl("_membership"), { headers }).then(
(response) => response.json(),
);
if (!membership || membership.error) {
throw new Error(`_membership error ${JSON.stringify(membership)}`);
}
for (const node of membership.cluster_nodes) {
for (const [configPath, value] of Object.entries(corsConfig)) {
const corsURL = `_node/${node}/_config/${configPath}`;
const response = await fetch(getUrl(corsURL), {
method: "PUT",
headers,
body: JSON.stringify(value),
}).then((response) => response.json());
if (!response.error) {
console.log(`set ${configPath} ${response}`);
} else {
throw new Error(
`${corsURL} set ${value} error ${JSON.stringify(response)}`,
);
}
}
}
};
export const down = async () => {
+2
View File
@@ -16,6 +16,8 @@
"pouchdb-find": "^9.0.0"
},
"scripts": {
"build": "echo 'no build' && exit 0",
"lint": "echo 'no lint' && exit 0",
"migrate": "migrate"
}
}
@@ -29,6 +29,7 @@
"scripts": {
"start": "node dist/server.js",
"build": "tsc",
"lint": "tsc --noEmit",
"generate-keys": "node src/generate-keys.ts",
"test-send-notification": "node ./src/test-send-notification.js",
"test-send-notification-cancel": "node ./src/test-send-notification-cancel.js"