diff --git a/.github/workflows/deploy-billboard.yml b/.github/workflows/deploy-billboard.yml new file mode 100644 index 000000000..74e1b571b --- /dev/null +++ b/.github/workflows/deploy-billboard.yml @@ -0,0 +1,92 @@ +name: Staging billboard deploy +on: push + +jobs: + messenger-demo-deploy: + environment: devconnect2023 + runs-on: ubuntu-latest + # if: ${{ contains( github.ref, vars.STAGING_BRANCH) }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + registry-url: 'https://npm.pkg.github.com' + node-version: 18.0.0 + cache: 'yarn' + - name: Declare some variables + shell: bash + run: | + echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV" + echo "now=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV + - name: Prepare SSH + run: | + mkdir ~/.ssh + echo "${{ secrets.STAGING_HOST_SSH }}" > ~/.ssh/known_hosts + echo "${{ secrets.DO_SSH_KEY }}" > ./ssh-key + chmod 600 ./ssh-key + - name: Create .env file + env: + TARGET_HOST: ${{ secrets.STAGING_HOST }} + TARGET_IP: ${{ secrets.IP_ADDRESS }} + run: | + echo "REACT_APP_ADDR_ENS_SUBDOMAIN=.addr.devconnect.dm3.eth" >> ./.env.react + echo "REACT_APP_BACKEND=https://${{ secrets.STAGING_HOST }}/api" >> ./.env.react + echo "REACT_APP_DEFAULT_DELIVERY_SERVICE=bb-ds.devconnect.dm3.eth" >> ./.env.react + echo "REACT_APP_DEFAULT_SERVICE=https://${{ secrets.STAGING_HOST }}/api" >> ./.env.react + echo "REACT_APP_ETHEREUM_PROVIDER=${{ secrets.REACT_APP_ETHEREUM_PROVIDER }}" >> ./.env.react + echo "REACT_APP_PROFILE_BASE_URL=https://${{ secrets.STAGING_HOST }}/api" >> ./.env.react + echo "REACT_APP_RESOLVER_BACKEND=https://${{ secrets.STAGING_HOST }}/resolver-handler" >> ./.env.react + echo "REACT_APP_USER_ENS_SUBDOMAIN=.user.devconnect.dm3.eth" >> ./.env.react + echo "REACT_APP_WALLET_CONNECT_PROJECT_ID=${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }}" >> ./.env.react + echo "REACT_APP_COMMIT_HASH=${{ env.sha_short }}" >> ./.env.react + echo "REACT_APP_BRANCH=${{ env.branch }}" >> ./.env.react + echo "REACT_APP_BUILD_TIME=${{ env.now }}" >> ./.env.react + cat ./.env.react >> ./.env + echo "BILLBOARD_SIGNER_PRIVATE_KEY=${{ secrets.BILLBOARD_SIGNER_PRIVATE_KEY }}" >> ./.env + echo "RESOLVER_ADDR=0xae6646c22D8eE6479eE0a39Bf63B9bD9e57bAD9d" >> ./.env + echo "SIGNING_PUBLIC_KEY=${{ secrets.SIGNING_PUBLIC_KEY }}" >> ./.env + echo "SIGNING_PRIVATE_KEY=${{ secrets.SIGNING_PRIVATE_KEY }}" >> ./.env + echo "SIGNER_PRIVATE_KEY=${{ secrets.SIGNER_PRIVATE_KEY }}" >> ./.env + echo "SPAM_PROTECTION=${{ secrets.SPAM_PROTECTION }}" >> ./.env + echo "ENCRYPTION_PUBLIC_KEY=${{ secrets.ENCRYPTION_PUBLIC_KEY }}" >> ./.env + echo "ENCRYPTION_PRIVATE_KEY=${{ secrets.ENCRYPTION_PRIVATE_KEY }}" >> ./.env + echo "RPC=${{ secrets.STAGING_RPC }}" >> ./.env + echo "BILLBOARD_PRIVATE_KEY=${{ secrets.BILLBOARD_PRIVATE_KEY }}" >> ./.env + echo "interceptor=${{ secrets.INTERCEPTOR }}" >> ./.env + echo "DISABLE_SESSION_CHECK='true'" >> ./.env + echo "BILLBOARD_NAMES=${{ secrets.BILLBOARD_NAMES }}" >> ./.env + echo "CERT_MAIL=${{ secrets.CERT_MAIL }}" >> ./.env + echo "URL=${{ secrets.STAGING_HOST }}" >> ./.env + envsubst '${TARGET_HOST}' < ./docker/billboard/nginx.conf > ./nginx.conf + cat ./.env + - name: Build docker image + run: | + cp ./.env.react packages/messenger-demo/.env + docker build --progress=plain -t dm3-backend:latest -f ./docker/Dockerfile . + docker save -o ./dm3-backend.tar dm3-backend:latest + - name: Sync files + run: | + rsync -avz -e 'ssh -i ./ssh-key' ./.env app@${{ secrets.STAGING_HOST }}:/home/app/dm3 + rsync -avz -e 'ssh -i ./ssh-key' ./dm3-backend.tar app@${{ secrets.STAGING_HOST }}:/home/app/dm3 + rsync -avz -e 'ssh -i ./ssh-key' ./nginx.conf app@${{ secrets.STAGING_HOST }}:/home/app/dm3 + rsync -avz -e 'ssh -i ./ssh-key' ./docker/billboard/docker-compose.yml app@${{ secrets.STAGING_HOST }}:/home/app/dm3 + - name: Prepare docker + run: | + ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ + cd dm3 && docker compose down && docker system prune -af" + ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\ + systemctl restart docker.service" + - name: Load docker image + run: | + ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ + cd dm3 && docker load -i dm3-backend.tar; \ + rm dm3-backend.tar || true" + - name: Firewall config + run: | + ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\ + ufw allow from 172.18.0.1/16 proto tcp to ${{ secrets.IP_ADDRESS }} port 80" + - name: Start + run: | + ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ + cd dm3 && docker compose --env-file .env up -d" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8d2882507..8b76c6ee1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Push Workflow +name: Staging deploy on: push jobs: @@ -56,23 +56,23 @@ jobs: cp ./.env.react packages/messenger-demo/.env docker build --progress=plain -t dm3-backend:latest -f ./docker/Dockerfile . docker save -o ./dm3-backend.tar dm3-backend:latest + - name: Prepare docker + run: | + ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ + cd dm3 && docker compose down && docker system prune -af" + ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\ + systemctl restart docker.service \ + rm /home/app/dm3-backend.tar || true" - name: Sync files run: | rsync -avz -e 'ssh -i ./ssh-key' ./.env app@${{ secrets.STAGING_HOST }}:/home/app/dm3 rsync -avz -e 'ssh -i ./ssh-key' ./dm3-backend.tar app@${{ secrets.STAGING_HOST }}:/home/app/dm3 rsync -avz -e 'ssh -i ./ssh-key' ./nginx.conf app@${{ secrets.STAGING_HOST }}:/home/app/dm3 rsync -avz -e 'ssh -i ./ssh-key' ./docker/docker-compose.yml app@${{ secrets.STAGING_HOST }}:/home/app/dm3 - - name: Prepare docker - run: | - ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ - cd dm3 && docker compose down && docker system prune -af" - ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\ - systemctl restart docker.service" - name: Load docker image run: | ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\ - cd dm3 && docker load -i dm3-backend.tar; \ - rm dm3-backend.tar || true" + cd dm3 && docker load -i dm3-backend.tar" - name: Firewall config run: | ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\ diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 0dcf17cc8..da94a52be 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -1,4 +1,4 @@ -name: Push Workflow +name: Build and test on: push jobs: diff --git a/docker/Dockerfile b/docker/Dockerfile index 193168926..03ee858a6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM --platform=linux/amd64 node:18-alpine WORKDIR /app COPY . . -RUN apk add --update python3 make g++\ +RUN apk add --update python3 make g++ curl\ && rm -rf /var/cache/apk/* RUN yarn install RUN yarn build diff --git a/docker/billboard/docker-compose.yml b/docker/billboard/docker-compose.yml new file mode 100644 index 000000000..adf1f4eee --- /dev/null +++ b/docker/billboard/docker-compose.yml @@ -0,0 +1,134 @@ +version: "3.1" +services: + + nginx: + container_name: nginx + image: nginx:latest + restart: always + depends_on: + - billboard-client + - backend + - ccip-resolver + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + - web-root:/var/www/html + - certbot-etc:/etc/letsencrypt + - certbot-var:/var/lib/letsencrypt + ports: + - "80:80" + - "443:443" + + backend: + image: dm3-backend + command: yarn workspace dm3-backend start + depends_on: + - db + environment: + REDIS_URL: redis://db:6379 + SIGNING_PUBLIC_KEY: ${SIGNING_PUBLIC_KEY} + SIGNING_PRIVATE_KEY: ${SIGNING_PRIVATE_KEY} + ENCRYPTION_PUBLIC_KEY: ${ENCRYPTION_PUBLIC_KEY} + ENCRYPTION_PRIVATE_KEY: ${ENCRYPTION_PRIVATE_KEY} + DISABLE_SESSION_CHECK: ${DISABLE_SESSION_CHECK} + RPC: ${RPC} + PORT: 8081 + LOG_LEVEL: 'debug' + + billboard-client: + image: dm3-backend + command: yarn workspace dm3-billboard-client start + depends_on: + db: + condition: service_started + ccip-resolver: + condition: service_started + offchain-resolver: + condition: service_healthy + environment: + PORT: 8083 + time: 0 + privateKey: ${BILLBOARD_PRIVATE_KEY} + ensNames: ${BILLBOARD_NAMES} + mediators: '[]' + REDIS_URL: redis://db:6379 + RPC: ${RPC} + LOG_LEVEL: 'debug' + + db: + image: redis + restart: always + + offchain-resolver-db: + image: postgres + restart: always + container_name: offchain_resolver_db + environment: + POSTGRES_PASSWORD: example + + offchain-resolver: + image: dm3-backend + command: yarn workspace dm3-offchain-resolver start + depends_on: + - offchain-resolver-db + environment: + DATABASE_URL: postgresql://postgres:example@offchain-resolver-db:5432 + PORT: 8082 + LOG_LEVEL: 'debug' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8082/0x26139b2349282de5ee2bd9c7a53171a28d6a6c84/0xf8c30f63000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001c0a62696c6c626f617264310762622d7573657203646d3303657468000000000000000000000000000000000000000000000000000000000000000000000000243b3b57de8d7fcfd6548aae2cdb5851741139459856caadb3b9ad3d27872ae921b2348a7d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014bcd6de065fd7e889e3ec86aa2d2780d7553ab3cc000000000000000000000000"] + interval: 30s + timeout: 10s + retries: 5 + + # web: + # image: dm3-backend + # command: yarn workspace messenger-demo start + # environment: + # REACT_APP_ADDR_ENS_SUBDOMAIN: ${REACT_APP_ADDR_ENS_SUBDOMAIN} + # REACT_APP_BACKEND: ${REACT_APP_BACKEND} + # REACT_APP_DEFAULT_DELIVERY_SERVICE: ${REACT_APP_DEFAULT_DELIVERY_SERVICE} + # REACT_APP_DEFAULT_SERVICE: ${REACT_APP_DEFAULT_SERVICE} + # REACT_APP_ETHEREUM_PROVIDER: ${REACT_APP_ETHEREUM_PROVIDER} + # REACT_APP_PROFILE_BASE_URL: ${REACT_APP_PROFILE_BASE_URL} + # REACT_APP_RESOLVER_BACKEND: ${REACT_APP_RESOLVER_BACKEND} + # REACT_APP_USER_ENS_SUBDOMAIN: ${REACT_APP_USER_ENS_SUBDOMAIN} + # REACT_APP_WALLET_CONNECT_PROJECT_ID: ${REACT_APP_WALLET_CONNECT_PROJECT_ID} + # RESOLVER_ADDR: ${RESOLVER_ADDR} + + certbot: + image: certbot/certbot + container_name: certbot + volumes: + - certbot-etc:/etc/letsencrypt + - certbot-var:/var/lib/letsencrypt + - web-root:/var/www/html + depends_on: + - nginx + command: certonly --webroot --webroot-path=/var/www/html --email ${CERT_MAIL} --agree-tos --no-eff-email -d ${URL} + + ccip-resolver: + image: dm3org/ccip-resolver:v0.2.7 + restart: always + depends_on: + offchain-resolver: + condition: service_healthy + environment: + SIGNER_PRIVATE_KEY: ${BILLBOARD_SIGNER_PRIVATE_KEY} + LOG_LEVEL: debug + CONFIG: | + { + "0xc9bf092673b3a066df088a2a911e23e9b69b82f2": { + "type": "signing", + "handlerUrl": "http://offchain-resolver:8082" + } + } + PORT: 8181 +volumes: + certbot-etc: + certbot-var: + web-root: + driver: local + driver_opts: + type: none + device: /home/app/dm3/webroot/ + o: bind diff --git a/docker/billboard/nginx.conf b/docker/billboard/nginx.conf new file mode 100644 index 000000000..5a89fbdcc --- /dev/null +++ b/docker/billboard/nginx.conf @@ -0,0 +1,123 @@ +events { + worker_connections 1024; +} + +http { + keepalive_timeout 65; + limit_req_zone $binary_remote_addr zone=standardlimit:10m rate=3r/s; + limit_req_zone $binary_remote_addr zone=legacylimit:10m rate=2r/s; + + server { + listen 80; + server_name ${TARGET_HOST}; + + return 301 https://$server_name$request_uri; + } + + server { + listen 80; + server_name ${TARGET_IP}; + + return 301 https://${TARGET_HOST}$request_uri; + } + + server { + listen 443 ssl; + server_name ${TARGET_HOST}; + + ssl_certificate /etc/letsencrypt/live/${TARGET_HOST}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/${TARGET_HOST}/privkey.pem; + + # location / { + # limit_req zone=standardlimit burst=50; + # proxy_pass http://web:8080; + # proxy_set_header Host $host; + # proxy_set_header X-Real-IP $remote_addr; + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # proxy_set_header X-Forwarded-Proto $scheme; + + # proxy_redirect off; + # } + + location /resolver { + rewrite ^/resolver(.*)$ $1 break; + limit_req zone=standardlimit burst=50; + proxy_pass http://ccip-resolver:8181; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_ssl_verify off; + proxy_redirect off; + } + + location /resolver-handler { + rewrite ^/resolver-handler(.*)$ $1 break; + limit_req zone=standardlimit burst=50; + proxy_pass http://offchain-resolver:8082; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_ssl_verify off; + proxy_redirect off; + } + + location /api { + rewrite ^/api(.*)$ $1 break; + limit_req zone=standardlimit burst=50; + proxy_pass http://backend:8081; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_ssl_verify off; + proxy_redirect off; + } + + location /bb-client { + rewrite ^/bb-client(.*)$ $1 break; + limit_req zone=standardlimit burst=50; + proxy_pass http://billboard-client:8083; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_ssl_verify off; + proxy_redirect off; + } + + location /socket.io { + proxy_pass http://backend:8081/socket.io; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect off; + proxy_ssl_verify off; + proxy_set_header Host $host; + } + + location /bb-client/socket.io { + rewrite ^/bb-client(.*)$ $1 break; + proxy_pass http://billboard-client:8083/socket.io; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect off; + proxy_set_header Host $host; + } + + location ~ /.well-known/acme-challenge { + allow all; + root /var/www/html; + } + + + } +} \ No newline at end of file diff --git a/package.json b/package.json index a5fc8496d..ccd7a0c7c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "private": true, + "name": "dm3", "workspaces": { "packages": [ "packages/lib/shared", @@ -19,7 +19,10 @@ "packages/offchain-resolver", "packages/messenger-widget", "packages/messenger-demo", - "packages/cli" + "packages/messenger-web", + "packages/cli", + "packages/billboard-client", + "packages/billboard-widget" ], "nohoist": [ "**/react", @@ -51,7 +54,8 @@ "format": "prettier --write '*/**/*.{js,ts,tsx,json}'", "format:check": "prettier --check '*/**/*.{js,ts,tsx,json}'", "prepare": "husky install", - "test": "yarn workspaces foreach -p run test" + "test": "yarn workspaces foreach -p run test", + "cli": "yarn workspace dm3-cli start" }, "packageManager": "yarn@3.5.1", "resolutions": { diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 63c04ae80..568cfdaa4 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -16,6 +16,7 @@ import Profile from './profile'; import RpcProxy from './rpc/rpc-proxy'; import Storage from './storage'; import { logInfo } from 'dm3-lib-shared'; +import 'dotenv/config'; import { errorHandler, diff --git a/packages/backend/src/profile.ts b/packages/backend/src/profile.ts index e0673954c..02382b7df 100644 --- a/packages/backend/src/profile.ts +++ b/packages/backend/src/profile.ts @@ -70,6 +70,8 @@ export default () => { method: 'POST', url: req.url, ensName, + disableSessionCheck: + process.env.DISABLE_SESSION_CHECK === 'true', }); const data = await submitUserProfile( @@ -90,6 +92,10 @@ export default () => { res.json(data); } catch (e) { + global.logger.warn({ + message: 'POST profile', + error: JSON.stringify(e), + }); res.status(400).send({ message: `Couldn't store profile`, error: JSON.stringify(e), diff --git a/packages/backend/src/rpc/methods/handleSubmitMessage.ts b/packages/backend/src/rpc/methods/handleSubmitMessage.ts index f0edcd138..e7f737bff 100644 --- a/packages/backend/src/rpc/methods/handleSubmitMessage.ts +++ b/packages/backend/src/rpc/methods/handleSubmitMessage.ts @@ -62,7 +62,7 @@ export async function handleSubmitMessage( } catch (error) { global.logger.warn({ method: 'RPC SUBMIT MESSAGE', - error, + error: JSON.stringify(error), }); logError({ text: '[handleSubmitMessage]', diff --git a/packages/billboard-client/src/api/internal/ws/getDeliveryServiceWSConnections.ts b/packages/billboard-client/src/api/internal/ws/getDeliveryServiceWSConnections.ts index ee7d07e7f..b54ab30b5 100644 --- a/packages/billboard-client/src/api/internal/ws/getDeliveryServiceWSConnections.ts +++ b/packages/billboard-client/src/api/internal/ws/getDeliveryServiceWSConnections.ts @@ -14,7 +14,7 @@ export const getDeliveryServiceWSClient = ( return Promise.all( deliveryServices.map(async (ds) => { const client = await new Promise((res, rej) => { - const c = io(ds.url, { + const c = io(ds.url.replace('/api', ''), { auth: { account: { ensName }, token: ds.token, diff --git a/packages/billboard-client/src/index.ts b/packages/billboard-client/src/index.ts index 532a347db..6fe526bc9 100644 --- a/packages/billboard-client/src/index.ts +++ b/packages/billboard-client/src/index.ts @@ -2,6 +2,7 @@ import { ethers } from 'ethers'; import winston from 'winston'; import { getBillboardClientApp } from './getBillboardClientApp'; import { getDatabase } from './persitance/getDatabase'; +import 'dotenv/config'; const main = async () => { const rpcUrl = process.env['RPC']; diff --git a/packages/billboard-client/src/service/viewerService/viewerService.ts b/packages/billboard-client/src/service/viewerService/viewerService.ts index 2191b3c39..9a10ca317 100644 --- a/packages/billboard-client/src/service/viewerService/viewerService.ts +++ b/packages/billboard-client/src/service/viewerService/viewerService.ts @@ -2,6 +2,7 @@ import { Message } from 'dm3-lib-messaging'; import http from 'http'; import { Server, Socket } from 'socket.io'; import { IViewerService } from './IViewerService'; +import { logDebug } from 'dm3-lib-shared'; /** * Creates and returns an instance of a viewer service that manages viewer connections and message broadcasting. @@ -20,6 +21,12 @@ export function ViewerService(httpServer: http.Server): IViewerService { const connections: Map = new Map(); const addConnection = (connection: Socket) => { + logDebug({ + text: '[ViewerService] connect', + id: connection.id, + connectionsSize: connections.size, + }); + //When the socket disconnects we wan't them no longer in our viewers List connection.on('disconnect', () => { removeConnection(connection); @@ -28,10 +35,19 @@ export function ViewerService(httpServer: http.Server): IViewerService { }; const removeConnection = (connection: Socket) => { + logDebug({ + text: '[ViewerService] disconnect', + id: connection.id, + connectionsSize: connections.size, + }); connections.delete(connection.id); }; const getViewerCount = () => { + logDebug({ + text: '[ViewerService] getViewerCount', + connectionsSize: connections.size, + }); return connections.size; }; diff --git a/packages/billboard-client/test/helper/mockUserProfile.ts b/packages/billboard-client/test/helper/mockUserProfile.ts index a5c710647..f361f5f2a 100644 --- a/packages/billboard-client/test/helper/mockUserProfile.ts +++ b/packages/billboard-client/test/helper/mockUserProfile.ts @@ -1,6 +1,7 @@ import { createStorageKey, getStorageKeyCreationMessage } from 'dm3-lib-crypto'; import { Account, + DEFAULT_NONCE, ProfileKeys, SignedUserProfile, UserProfile, @@ -24,17 +25,14 @@ export const mockUserProfile = async ( stringified: string; }> => { const storageKeyCreationMessage = getStorageKeyCreationMessage( - '0xca8f04fdc80d659997f69b02', + DEFAULT_NONCE, wallet.address, ); const storageKeySig = await wallet.signMessage(storageKeyCreationMessage); const storageKey = await createStorageKey(storageKeySig); - const profileKeys = await createProfileKeys( - storageKey, - '0xca8f04fdc80d659997f69b02', - ); + const profileKeys = await createProfileKeys(storageKey, DEFAULT_NONCE); const profile: UserProfile = { publicSigningKey: profileKeys.signingKeyPair.publicKey, @@ -43,6 +41,7 @@ export const mockUserProfile = async ( }; const createUserProfileMessage = getProfileCreationMessage( stringify(profile), + wallet.address, ); const userProfileSig = await wallet.signMessage(createUserProfileMessage); diff --git a/packages/billboard-widget/buildCss.js b/packages/billboard-widget/buildCss.js index f6f1c53e8..3220a4cb7 100644 --- a/packages/billboard-widget/buildCss.js +++ b/packages/billboard-widget/buildCss.js @@ -2,7 +2,11 @@ const esbuild = require('esbuild'); async function build() { await esbuild.build({ - entryPoints: ['src/styles/app.pcss', 'src/styles/classic.pcss'], + entryPoints: [ + 'src/styles/app.pcss', + 'src/styles/classic.pcss', + 'src/styles/streameth.pcss', + ], outdir: 'dist/styles/', minify: true, bundle: true, diff --git a/packages/billboard-widget/package.json b/packages/billboard-widget/package.json index cb2d1b236..aecf1f2fd 100644 --- a/packages/billboard-widget/package.json +++ b/packages/billboard-widget/package.json @@ -1,6 +1,6 @@ { "name": "dm3-billboard-widget", - "version": "0.2.12", + "version": "0.3.2", "files": [ "dist" ], @@ -8,7 +8,7 @@ "main": "./dist/index.js", "scripts": { "dev": "vite", - "build": "echo 'skip build'", + "build": "vite build", "build:css": "node ./buildCss.js", "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" diff --git a/packages/billboard-widget/src/components/CreateMessage.tsx b/packages/billboard-widget/src/components/CreateMessage.tsx index b768ad56d..7776f9f69 100644 --- a/packages/billboard-widget/src/components/CreateMessage.tsx +++ b/packages/billboard-widget/src/components/CreateMessage.tsx @@ -14,17 +14,6 @@ const MIN_MESSAGE_LENGTH = 5; // Workaround since TS complains about the about enterkeyhint attribute. // TODO: should actually be fixed in current react/TS versions. -declare module 'react' { - interface TextareaHTMLAttributes - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - //@ts-ignore - extends AriaAttributes, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - //@ts-ignore - DOMAttributes { - enterkeyhint?: string; - } -} function CreateMessage(props: Props) { const { ensName } = useContext(AuthContext); @@ -84,6 +73,7 @@ function CreateMessage(props: Props) {