mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 11:27:03 +00:00
Bump welshman, rename stripExifData
This commit is contained in:
22
package.json
22
package.json
@@ -58,17 +58,17 @@
|
|||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"@vite-pwa/assets-generator": "^0.2.6",
|
"@vite-pwa/assets-generator": "^0.2.6",
|
||||||
"@vite-pwa/sveltekit": "^0.6.6",
|
"@vite-pwa/sveltekit": "^0.6.6",
|
||||||
"@welshman/app": "^0.4.6",
|
"@welshman/app": "^0.4.7",
|
||||||
"@welshman/content": "^0.4.6",
|
"@welshman/content": "^0.4.7",
|
||||||
"@welshman/editor": "^0.4.6",
|
"@welshman/editor": "^0.4.7",
|
||||||
"@welshman/feeds": "^0.4.6",
|
"@welshman/feeds": "^0.4.7",
|
||||||
"@welshman/lib": "^0.4.6",
|
"@welshman/lib": "^0.4.7",
|
||||||
"@welshman/net": "^0.4.6",
|
"@welshman/net": "^0.4.7",
|
||||||
"@welshman/relay": "^0.4.6",
|
"@welshman/relay": "^0.4.7",
|
||||||
"@welshman/router": "^0.4.6",
|
"@welshman/router": "^0.4.7",
|
||||||
"@welshman/signer": "^0.4.6",
|
"@welshman/signer": "^0.4.7",
|
||||||
"@welshman/store": "^0.4.6",
|
"@welshman/store": "^0.4.7",
|
||||||
"@welshman/util": "^0.4.6",
|
"@welshman/util": "^0.4.7",
|
||||||
"compressorjs": "^1.2.1",
|
"compressorjs": "^1.2.1",
|
||||||
"daisyui": "^4.12.10",
|
"daisyui": "^4.12.10",
|
||||||
"date-picker-svelte": "^2.13.0",
|
"date-picker-svelte": "^2.13.0",
|
||||||
|
|||||||
BIN
pnpm-lock.yaml
generated
BIN
pnpm-lock.yaml
generated
Binary file not shown.
@@ -45,7 +45,7 @@
|
|||||||
idea is that you have a public key, which acts as your user ID, and a private key which allows you to
|
idea is that you have a public key, which acts as your user ID, and a private key which allows you to
|
||||||
prove your identity.
|
prove your identity.
|
||||||
|
|
||||||
It's very important to keep your private key safe because it grants permanent and complete access to your
|
It's very important to keep your private key secret because it grants permanent and complete access to your
|
||||||
account.
|
account.
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {Editor, MentionSuggestion, WelshmanExtension} from "@welshman/editor"
|
|||||||
import {makeMentionNodeView} from "./MentionNodeView"
|
import {makeMentionNodeView} from "./MentionNodeView"
|
||||||
import ProfileSuggestion from "./ProfileSuggestion.svelte"
|
import ProfileSuggestion from "./ProfileSuggestion.svelte"
|
||||||
import {pushToast} from "@app/util/toast"
|
import {pushToast} from "@app/util/toast"
|
||||||
import {stripExifData} from "@src/lib/html"
|
import {compressFile} from "@src/lib/html"
|
||||||
|
|
||||||
export const getBlossomServer = () => {
|
export const getBlossomServer = () => {
|
||||||
const userUrls = getTagValues("server", getListTags(userBlossomServers.get()))
|
const userUrls = getTagValues("server", getListTags(userBlossomServers.get()))
|
||||||
@@ -74,7 +74,7 @@ export const makeEditor = async ({
|
|||||||
let file: Blob = attrs.file
|
let file: Blob = attrs.file
|
||||||
|
|
||||||
if (!file.type.match("image/(webp|gif)")) {
|
if (!file.type.match("image/(webp|gif)")) {
|
||||||
file = await stripExifData(file)
|
file = await compressFile(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
const {ciphertext, key, nonce, algorithm} = await encryptFile(file)
|
const {ciphertext, key, nonce, algorithm} = await encryptFile(file)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {randomId} from "@welshman/lib"
|
import {randomId} from "@welshman/lib"
|
||||||
import {preventDefault, stopPropagation, stripExifData} from "@lib/html"
|
import {preventDefault, stopPropagation, compressFile} from "@lib/html"
|
||||||
import CloseCircle from "@assets/icons/close-circle.svg?dataurl"
|
import CloseCircle from "@assets/icons/close-circle.svg?dataurl"
|
||||||
import AddCircle from "@assets/icons/add-circle.svg?dataurl"
|
import AddCircle from "@assets/icons/add-circle.svg?dataurl"
|
||||||
import GallerySend from "@assets/icons/gallery-send.svg?dataurl"
|
import GallerySend from "@assets/icons/gallery-send.svg?dataurl"
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
const onDrop = async (e: any) => {
|
const onDrop = async (e: any) => {
|
||||||
active = false
|
active = false
|
||||||
|
|
||||||
file = await stripExifData(e.dataTransfer.files[0])
|
file = await compressFile(e.dataTransfer.files[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChange = async (e: any) => {
|
const onChange = async (e: any) => {
|
||||||
file = await stripExifData(e.target.files[0])
|
file = await compressFile(e.target.files[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {randomId} from "@welshman/lib"
|
import {randomId} from "@welshman/lib"
|
||||||
import {preventDefault, stopPropagation, stripExifData} from "@lib/html"
|
import {preventDefault, stopPropagation, compressFile} from "@lib/html"
|
||||||
import CloseCircle from "@assets/icons/close-circle.svg?dataurl"
|
import CloseCircle from "@assets/icons/close-circle.svg?dataurl"
|
||||||
import AddCircle from "@assets/icons/add-circle.svg?dataurl"
|
import AddCircle from "@assets/icons/add-circle.svg?dataurl"
|
||||||
import GallerySend from "@assets/icons/gallery-send.svg?dataurl"
|
import GallerySend from "@assets/icons/gallery-send.svg?dataurl"
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
const onDrop = async (e: any) => {
|
const onDrop = async (e: any) => {
|
||||||
active = false
|
active = false
|
||||||
|
|
||||||
file = await stripExifData(e.dataTransfer.files[0])
|
file = await compressFile(e.dataTransfer.files[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChange = async (e: any) => {
|
const onChange = async (e: any) => {
|
||||||
file = await stripExifData(e.target.files[0])
|
file = await compressFile(e.target.files[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {sleep, last} from "@welshman/lib"
|
import {sleep, last, randomId} from "@welshman/lib"
|
||||||
export {preventDefault, stopPropagation} from "svelte/legacy"
|
export {preventDefault, stopPropagation} from "svelte/legacy"
|
||||||
|
|
||||||
export const copyToClipboard = (text: string) => {
|
export const copyToClipboard = (text: string) => {
|
||||||
@@ -136,29 +136,23 @@ export const scrollToEvent = async (id: string, attempts = 3): Promise<boolean>
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export const stripExifData = async (file, {maxWidth = null, maxHeight = null} = {}) => {
|
export const compressFile = async (file: File | Blob): Promise<File> => {
|
||||||
if (window.DataTransferItem && file instanceof DataTransferItem) {
|
|
||||||
file = file.getAsFile()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file) {
|
|
||||||
return file
|
|
||||||
}
|
|
||||||
|
|
||||||
const {default: Compressor} = await import("compressorjs")
|
const {default: Compressor} = await import("compressorjs")
|
||||||
|
|
||||||
/* eslint no-new: 0 */
|
return new Promise<File>((resolve, _reject) => {
|
||||||
|
|
||||||
return new Promise((resolve, _reject) => {
|
|
||||||
new Compressor(file, {
|
new Compressor(file, {
|
||||||
maxWidth: maxWidth || 2048,
|
maxWidth: 2048,
|
||||||
maxHeight: maxHeight || 2048,
|
maxHeight: 2048,
|
||||||
convertSize: 10 * 1024 * 1024,
|
convertSize: 10 * 1024 * 1024,
|
||||||
success: resolve,
|
success: result => resolve(result as File),
|
||||||
error: e => {
|
error: e => {
|
||||||
// Non-images break compressor
|
// Non-images break compressor, return the original file
|
||||||
if (e.toString().includes("File or Blob")) {
|
if (e.toString().includes("File or Blob")) {
|
||||||
return resolve(file)
|
if (file instanceof Blob) {
|
||||||
|
file = new File([file], `${randomId()}.${file.type}`, {type: file.type})
|
||||||
|
}
|
||||||
|
|
||||||
|
return resolve(file as File)
|
||||||
}
|
}
|
||||||
|
|
||||||
_reject(e)
|
_reject(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user