Skip to content

Commit

Permalink
format and eslint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ticruz38 committed Jan 21, 2025
1 parent 71de0b6 commit 46e221c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/app/shared/NoteReply.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {drafts, openReplies} from "src/app/state"
import {getClientTags, publish, sign, userSettings} from "src/engine"
import {getEditor} from "src/app/editor"
import { powEvent } from "src/util/pow"
import {powEvent} from "src/util/pow"
export let parent
export let showBorder = false
Expand Down Expand Up @@ -94,10 +94,10 @@
const template = createEvent(kind, {content, tags})
let event = await sign(template, options)
if ($userSettings.pow_difficulty || options.pow_difficulty) {
if ($userSettings.pow_difficulty || options.pow_difficulty) {
event = await powEvent(event, $userSettings.pow_difficulty || options.pow_difficulty)
}
const thunk = publish({
event,
relays: ctx.app.router.PublishEvent(event).getUrls(),
Expand Down
37 changes: 20 additions & 17 deletions src/app/views/NoteCreate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
import {router} from "src/app/util/router"
import {env, getClientTags, makeDvmRequest, publish, sign, userSettings} from "src/engine"
import {warn} from "src/util/logger"
import { powEvent } from "src/util/pow"
import {powEvent} from "src/util/pow"
export let quote = null
export let pubkey = null
Expand All @@ -51,7 +50,12 @@
let editor: ReturnType<typeof getEditor>
let element: HTMLElement
let options = {warning: "", anonymous: false, publish_at: null, pow_difficulty: $userSettings.pow_difficulty || 0}
let options = {
warning: "",
anonymous: false,
publish_at: null,
pow_difficulty: $userSettings.pow_difficulty || 0,
}
const SHIPYARD_PUBKEY = "85c20d3760ef4e1976071a569fb363f4ff086ca907669fb95167cdc5305934d1"
const nsecWarning = writable(null)
Expand All @@ -77,38 +81,37 @@
const onSubmit = async ({skipNsecWarning = false} = {}) => {
// prevent sending before media are uploaded
if ($uploading || publishing) return
const content = $editor.getText({blockSeparator: "\n"}).trim()
if (!content) return showWarning("Please provide a description.")
if (!skipNsecWarning && content.match(/\bnsec1.+/)) return nsecWarning.set(true)
const tags = [...$editor.storage.nostr.getEditorTags(), ...getClientTags()]
if (options.warning) {
tags.push(["content-warning", options.warning])
}
if (quote) {
tags.push(tagPubkey(quote.pubkey))
}
let template = createEvent(1, {
const template = createEvent(1, {
content,
tags,
created_at:
(options.publish_at && Math.floor(options.publish_at.getTime() / 1000)) || undefined,
(options.publish_at && Math.floor(options.publish_at.getTime() / 1000)) || undefined,
})
drafts.set("notecreate", $editor.getHTML())
publishing = "signing"
let event = await sign(template, options)
if ($userSettings.pow_difficulty || options.pow_difficulty) {
if ($userSettings.pow_difficulty || options.pow_difficulty) {
publishing = "pow"
event = await powEvent(event, $userSettings.pow_difficulty || options.pow_difficulty)
}
Expand Down Expand Up @@ -286,9 +289,9 @@
class="flex-grow"
disabled={$uploading || !!publishing}>
{#if $uploading || !!publishing}
{#if publishing == "signing"}
{#if publishing === "signing"}
<i class="fa fa-circle-notch fa-spin" /> Signing your note...
{:else if publishing == "pow"}
{:else if publishing === "pow"}
<i class="fa fa-circle-notch fa-spin" /> Generating PoW...
{/if}
{:else if options?.publish_at && Math.floor(options?.publish_at / 1000) > now()}
Expand Down
1 change: 0 additions & 1 deletion src/workers/pow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import crypto from "crypto"
import {getEventHash} from "nostr-tools"
import type {SignedEvent} from "@welshman/util"
import {} from "nostr-tools"
Expand Down

0 comments on commit 46e221c

Please sign in to comment.