create qr-codes by tg bot
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
VITE_API_URL=https://hereconnect.condev.ru/api
|
||||
VITE_API_URL=/api
|
||||
VITE_READ_BASE_URL=https://r.condev.ru
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
VITE_MANIFEST_NAME=НаСвязи-dev
|
||||
VITE_MANIFEST_SHORT_NAME=НаСвязи-dev
|
||||
VITE_PROXY_API_URL=https://hereconnect.condev.ru/api
|
||||
|
||||
@@ -12,7 +12,7 @@ node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
coverage
|
||||
.env.local
|
||||
.env.development.local
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
"test:e2e": "playwright test",
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --build --force",
|
||||
"lint": "eslint . --fix",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"format": "prettier --write src/",
|
||||
"vite-bundle-visualizer": "npx vite-bundle-visualizer"
|
||||
},
|
||||
"dependencies": {
|
||||
"@f3ve/vue-markdown-it": "^0.2.3",
|
||||
"@hereconnect/constants": "workspace:^",
|
||||
"@hereconnect/types": "^1.0.0",
|
||||
"@primevue/forms": "^4.2.1",
|
||||
"@primevue/themes": "^4.2.1",
|
||||
|
||||
@@ -12,7 +12,9 @@ import type {
|
||||
import { DB_NAMES } from '@/constants/dbNames'
|
||||
|
||||
export const getRemoteDb = <T extends BaseDocument>(dbName: DB_NAMES) =>
|
||||
new PouchDB<T>(`${import.meta.env.VITE_API_URL}/${dbName}`, { skip_setup: true })
|
||||
new PouchDB<T>(new URL(`${import.meta.env.VITE_API_URL}/${dbName}`, location.origin).toString(), {
|
||||
skip_setup: true,
|
||||
})
|
||||
|
||||
export const getLocalDb = <T extends BaseDocument>(dbName: DB_NAMES) => new PouchDB<T>(dbName)
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import type { QRCodeDocument } from '@hereconnect/types'
|
||||
import { EPOCH } from '@hereconnect/constants'
|
||||
import { qrCodeDbLocal, qrCodeDbRemote } from '@/api/dbs'
|
||||
import { getUserUuid } from '@/utils/getUserUuid'
|
||||
import { getBrowserUuid } from '@/utils/getBrowserUuid'
|
||||
import { isNotFoundError } from '@/api/PouchDB'
|
||||
|
||||
const EPOHE = 1731661630981
|
||||
|
||||
export const createQrCodeDocument = async (
|
||||
qrCodeDocPartial: Pick<
|
||||
QRCodeDocument,
|
||||
'name' | 'placement' | 'actions' | 'predefinedMessages' | 'messageDeliveryMethod'
|
||||
>,
|
||||
) => {
|
||||
const uri = Math.abs(Date.now() - EPOHE).toString(36)
|
||||
const uri = Math.abs(Date.now() - EPOCH).toString(36)
|
||||
const url = new URL(
|
||||
`${import.meta.env.VITE_READ_BASE_URL || '/read'}/${uri}`,
|
||||
location.origin,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, useTemplateRef, watch, nextTick } from 'vue'
|
||||
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
||||
import { messagesDbLocal as db, messagesDbRemote as remoteDb } from '@/api/dbs'
|
||||
import { type MessageDocument } from '@hereconnect/types'
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { qrCodePlacements } from '@/constants/qrCodePlacements'
|
||||
import { qrCodePlacements } from '@hereconnect/constants'
|
||||
import type { QRCodeDocument } from '@hereconnect/types'
|
||||
const selectedPlacement = defineModel<null | QRCodeDocument['placement']>()
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import type { QrCodePlacement } from '@/constants/qrCodePlacements'
|
||||
import type { QrCodePlacement } from '@hereconnect/constants'
|
||||
|
||||
const props = defineProps<{ placement: QrCodePlacement }>()
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { type QRCodeDocument } from '@hereconnect/types'
|
||||
|
||||
export type QrCodePlacement = QRCodeDocument['placement']
|
||||
|
||||
export const qrCodePlacements = [
|
||||
{ type: 'car', label: 'Автомобиль' },
|
||||
{ type: 'pet', label: 'Питомец' },
|
||||
{ type: 'door', label: 'Входная дверь дома или квартиры' },
|
||||
{ type: 'store', label: 'Магазин' },
|
||||
{ type: 'restaurant_table', label: 'Стол в кафе или ресторане' },
|
||||
{ type: 'other', label: 'Другое' },
|
||||
] as const satisfies { type: QrCodePlacement; label: string }[]
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const usePrefersColorSchemeStore = defineStore('prefersColorScheme', () => {
|
||||
|
||||
@@ -175,5 +175,14 @@ export default defineConfig(({ mode }) => {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_PROXY_API_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user