Release #310

Merged
b merged 6 commits from staging into main 2025-01-31 10:25:14 +00:00
8 changed files with 8857 additions and 14 deletions

View File

@ -26,9 +26,27 @@ jobs:
- name: Create Build
run: npm run build
- name: Release Build
- name: Deploy Build
run: |
npm -g install cloudron-surfer
surfer config --token ${{ secrets.CLOUDRON_SURFER_TOKEN }} --server sigit.io
surfer put dist/* / --all -d
surfer put dist/.well-known / --all
- name: Create Empty Release (assets are posted later)
run: |
npm i
npm i -g semantic-release
# We do a semantic-release DRY RUN to make the job fail if there are no changes to release
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release --dry-run | grep -q "There are no relevant changes, so no new version is released." && exit 1
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release
- name: Upload assets to release
run: |
RELEASE_ID=`curl -k 'https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.id'`
RELEASE_BODY=`curl -k 'https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.body'`
# Update body
curl --data '{"draft": false,"body":"'"$RELEASE_BODY\n\nFor installation instructions, please visit https://docs.sigit.io/#/"'"}' -X PATCH --header 'Content-Type: application/json' -k https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/$RELEASE_ID?access_token=${{ secrets.RELEASE_TOKEN }}
# Upload assets
URL="https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/$RELEASE_ID/assets?access_token=${{ secrets.RELEASE_TOKEN }}"
curl -k $URL -F attachment=@dist.zip

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-zip
dist-ssr
*.local

31
.releaserc Normal file
View File

@ -0,0 +1,31 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
]
}
],
[
"@saithodev/semantic-release-gitea",
{
"giteaUrl": "https://git.nostrdev.com/sigit/sigit.io",
"assets": [
{
"path": "dist-zip/dist.zip"
}
]
}
]
]
}

8714
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,8 @@
"preview": "vite preview",
"preinstall": "git config core.hooksPath .git-hooks",
"license-checker": "node licenseChecker.cjs",
"lint-staged": "lint-staged"
"lint-staged": "lint-staged",
"release": "commit-and-tag-version"
},
"dependencies": {
"@emotion/react": "11.11.4",
@ -65,6 +66,12 @@
"use-immer": "^0.11.0"
},
"devDependencies": {
"@saithodev/semantic-release-gitea": "^2.1.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^10.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "11.0.0",
"@semantic-release/release-notes-generator": "^11.0.4",
"@types/crypto-js": "^4.2.2",
"@types/file-saver": "2.0.7",
"@types/lodash": "4.14.202",
@ -75,6 +82,7 @@
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitejs/plugin-react": "^4.2.1",
"commit-and-tag-version": "^11.2.2",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
@ -85,6 +93,7 @@
"typescript": "^5.2.2",
"vite": "^5.1.4",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-zip-pack": "^1.2.4",
"vite-tsconfig-paths": "4.3.2"
},
"lint-staged": {

View File

@ -16,6 +16,7 @@ interface FileListProps {
setCurrentFile: (file: CurrentUserFile) => void
handleExport?: () => void
handleEncryptedExport?: () => void
reBroadcastSigit?: () => void
}
const FileList = ({
@ -23,7 +24,8 @@ const FileList = ({
currentFile,
setCurrentFile,
handleExport,
handleEncryptedExport
handleEncryptedExport,
reBroadcastSigit
}: FileListProps) => {
const isActive = (file: CurrentUserFile) => file.id === currentFile.id
return (
@ -91,6 +93,12 @@ const FileList = ({
)}
</PopupState>
)}
{typeof reBroadcastSigit === 'function' && (
<Button variant="contained" onClick={reBroadcastSigit}>
Re-Broadcast
</Button>
)}
</div>
)
}

View File

@ -28,7 +28,8 @@ import {
ARRAY_BUFFER,
DEFLATE,
uploadMetaToFileStorage,
decrypt
decrypt,
SignStatus
} from '../../utils'
import styles from './style.module.scss'
import { useLocation, useParams } from 'react-router-dom'
@ -217,6 +218,7 @@ export const VerifyPage = () => {
encryptionKey,
signers,
viewers,
signersStatus,
fileHashes,
parsedSignatureEvents,
timestamps
@ -732,6 +734,76 @@ export const VerifyPage = () => {
return Promise.resolve(arrayBuffer)
}
const reBroadcastSigit = async () => {
const usersNpub = hexToNpub(usersPubkey!)
if (!encryptionKey) {
toast.error('Encryption key is missing')
return
}
setIsLoading(true)
setLoadingSpinnerDesc('storing meta on blossom server')
let metaUrl: string
try {
metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
} catch (error) {
if (error instanceof Error) {
toast.error(error.message)
}
console.error(error)
setIsLoading(false)
return
}
const userSet = new Set<`npub1${string}`>()
if (submittedBy && submittedBy !== usersPubkey) {
userSet.add(hexToNpub(submittedBy))
}
// add all the signers who have signed and next signer to userSet
signers.forEach((signer) => {
// skip current user
if (signer === usersNpub) return
if (signersStatus[signer] === SignStatus.Signed) {
userSet.add(signer)
} else if (signersStatus[signer] === SignStatus.Awaiting) {
userSet.add(signer)
}
})
// If all signers have signed then include viewers too
if (
signers.every((signer) => signersStatus[signer] === SignStatus.Signed)
) {
viewers.forEach((viewer) => {
// skip current user
if (viewer === usersNpub) return
userSet.add(viewer)
})
}
setLoadingSpinnerDesc('Sending notifications')
const users = Array.from(userSet)
const promises = users.map((user) =>
sendNotification(npubToHex(user)!, { metaUrl, keys: meta.keys })
)
await Promise.all(promises)
.then(() => {
toast.success('Notifications sent successfully')
setMeta(meta)
})
.catch(() => {
toast.error('Failed to publish notifications')
})
setIsLoading(false)
}
return (
<>
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
@ -780,6 +852,7 @@ export const VerifyPage = () => {
setCurrentFile={setCurrentFile}
handleExport={handleExport}
handleEncryptedExport={handleEncryptedExport}
reBroadcastSigit={reBroadcastSigit}
/>
)
}

View File

@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import zipPack from 'vite-plugin-zip-pack'
export default defineConfig({
plugins: [
@ -9,7 +10,8 @@ export default defineConfig({
tsconfigPaths(),
nodePolyfills({
include: ['os']
})
}),
zipPack()
],
build: {
target: 'ES2022'