mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-04 00:20:39 +00:00
remove useless dependecies and use cli instead of package
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"@sveltejs/kit": "^2.5.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@zerodevx/svelte-toast": "^0.9.5",
|
||||
"adm-zip": "^0.5.10",
|
||||
"dotenv": "^16.4.5",
|
||||
@@ -29,11 +28,9 @@
|
||||
"vite": "^5.1.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cryptgeon/shared": "workspace:*",
|
||||
"cryptgeon": "workspace:*",
|
||||
"@fontsource/fira-mono": "^5.0.8",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"occulto": "^2.0.3",
|
||||
"occulto": "^2.0.6",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"qrious": "^4.0.2"
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { status as getStatus, type Status } from '@cryptgeon/shared'
|
||||
import { API, type Status } from 'cryptgeon/shared'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
export const status = writable<null | Status>(null)
|
||||
|
||||
export async function init() {
|
||||
status.set(await getStatus())
|
||||
status.set(await API.status())
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { toast, type SvelteToastOptions } from '@zerodevx/svelte-toast'
|
||||
import { toast } from '@zerodevx/svelte-toast'
|
||||
|
||||
export enum NotifyType {
|
||||
Success = 'success',
|
||||
Error = 'error',
|
||||
}
|
||||
|
||||
const themeMapping: Record<NotifyType, SvelteToastOptions['theme']> = {
|
||||
const themeMapping: Record<NotifyType, Record<string, string>> = {
|
||||
[NotifyType.Success]: {
|
||||
'--toastBackground': 'var(--ui-clr-primary)',
|
||||
'--toastBarBackground': 'var(--ui-clr-primary-alt)',
|
||||
@@ -17,7 +17,7 @@ const themeMapping: Record<NotifyType, SvelteToastOptions['theme']> = {
|
||||
}
|
||||
|
||||
function notifyFN(message: string, type: NotifyType = NotifyType.Success) {
|
||||
const options: SvelteToastOptions = {
|
||||
const options = {
|
||||
duration: 5_000,
|
||||
theme: {
|
||||
...themeMapping[type],
|
||||
|
@@ -4,7 +4,7 @@
|
||||
import { status } from '$lib/stores/status'
|
||||
import Switch from '$lib/ui/Switch.svelte'
|
||||
import TextInput from '$lib/ui/TextInput.svelte'
|
||||
import type { Note } from '@cryptgeon/shared'
|
||||
import type { Note } from 'cryptgeon/shared'
|
||||
|
||||
export let note: Note
|
||||
export let timeExpiration = false
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
import Button from '$lib/ui/Button.svelte'
|
||||
import MaxSize from '$lib/ui/MaxSize.svelte'
|
||||
import type { FileDTO } from '@cryptgeon/shared'
|
||||
import type { FileDTO } from 'cryptgeon/shared'
|
||||
|
||||
export let label: string = ''
|
||||
export let files: FileDTO[] = []
|
||||
|
@@ -1,16 +1,26 @@
|
||||
<script lang="ts" context="module">
|
||||
export type DecryptedNote = Omit<NotePublic, 'contents'> & { contents: any }
|
||||
|
||||
function saveAs(file: File) {
|
||||
const url = window.URL.createObjectURL(file)
|
||||
const a = document.createElement('a')
|
||||
a.style.display = 'none'
|
||||
a.href = url
|
||||
a.download = file.name
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
a.remove()
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import pkg from 'file-saver'
|
||||
const { saveAs } = pkg
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
import { t } from 'svelte-intl-precompile'
|
||||
|
||||
import Button from '$lib/ui/Button.svelte'
|
||||
import { copy } from '$lib/utils'
|
||||
import type { FileDTO, NotePublic } from '@cryptgeon/shared'
|
||||
import type { FileDTO, NotePublic } from 'cryptgeon/shared'
|
||||
|
||||
export let note: DecryptedNote
|
||||
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import copyToClipboard from 'copy-to-clipboard'
|
||||
import { t } from 'svelte-intl-precompile'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
import { notify } from './toast'
|
||||
|
||||
export function copy(value: string) {
|
||||
copyToClipboard(value)
|
||||
window.navigator.clipboard.writeText(value)
|
||||
const msg = get(t)('common.copied_to_clipboard')
|
||||
notify.success(msg)
|
||||
}
|
||||
|
@@ -13,8 +13,7 @@
|
||||
import Result, { type NoteResult } from '$lib/ui/NoteResult.svelte'
|
||||
import Switch from '$lib/ui/Switch.svelte'
|
||||
import TextArea from '$lib/ui/TextArea.svelte'
|
||||
import type { FileDTO, Note } from '@cryptgeon/shared'
|
||||
import { Adapters, PayloadToLargeError, create } from '@cryptgeon/shared'
|
||||
import { Adapters, API, PayloadToLargeError, type FileDTO, type Note } from 'cryptgeon/shared'
|
||||
|
||||
let note: Note = {
|
||||
contents: '',
|
||||
@@ -77,7 +76,7 @@
|
||||
else data.views = parseInt(note.views as any)
|
||||
|
||||
loading = $t('common.uploading')
|
||||
const response = await create(data)
|
||||
const response = await API.create(data)
|
||||
result = {
|
||||
id: response.id,
|
||||
password: customPassword ? undefined : Hex.encode(key),
|
||||
|
@@ -7,7 +7,7 @@
|
||||
import Loader from '$lib/ui/Loader.svelte'
|
||||
import ShowNote, { type DecryptedNote } from '$lib/ui/ShowNote.svelte'
|
||||
import TextInput from '$lib/ui/TextInput.svelte'
|
||||
import { Adapters, get, info, type NoteMeta } from '@cryptgeon/shared'
|
||||
import { Adapters, API, type NoteMeta } from 'cryptgeon/shared'
|
||||
import type { PageData } from './$types'
|
||||
|
||||
export let data: PageData
|
||||
@@ -28,7 +28,7 @@
|
||||
try {
|
||||
loading = $t('common.loading')
|
||||
password = window.location.hash.slice(1)
|
||||
const note = await info(id)
|
||||
const note = await API.info(id)
|
||||
meta = note.meta
|
||||
exists = true
|
||||
} catch {
|
||||
@@ -51,7 +51,7 @@
|
||||
// Load note
|
||||
error = null
|
||||
loading = $t('common.downloading')
|
||||
const data = await get(id)
|
||||
const data = await API.get(id)
|
||||
loading = $t('common.decrypting')
|
||||
const derived = meta?.derivation && (await AES.derive(password!, meta.derivation))
|
||||
const key = derived ? derived[0] : Hex.decode(password!)
|
||||
|
Reference in New Issue
Block a user