mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-29 16:04:08 +00:00
25 lines
545 B
TypeScript
25 lines
545 B
TypeScript
import sodium from 'libsodium-wrappers-sumo'
|
|
import {initUpload} from './upload.js'
|
|
import {initDownload} from './download.js'
|
|
|
|
async function main() {
|
|
await sodium.ready
|
|
|
|
const app = document.getElementById('app')!
|
|
const hash = window.location.hash.slice(1)
|
|
|
|
if (hash) {
|
|
initDownload(app, hash)
|
|
} else {
|
|
initUpload(app)
|
|
}
|
|
}
|
|
|
|
main().catch(err => {
|
|
const app = document.getElementById('app')
|
|
if (app) {
|
|
app.innerHTML = `<div class="error"><p>Failed to initialize: ${err.message}</p></div>`
|
|
}
|
|
console.error(err)
|
|
})
|