Make search work event when relays don't support it

This commit is contained in:
Jonathan Staab 2023-04-27 13:18:06 -05:00
parent f501eb1c29
commit d3a39facde
5 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
# Current
- [ ] Enable global view via env var
- [ ] Ask for name/image, first post on signup
- [ ] Fix cursor
- [ ] Add coupon code registration for relay
- [ ] Image classification
- https://github.com/bhky/opennsfw2

View File

@ -7,8 +7,6 @@ export const defaultFollows = (import.meta.env.VITE_DEFAULT_FOLLOWS || "")
.split(",")
.filter(identity)
console.log(defaultFollows)
export const getFollows = pubkey =>
Tags.wrap(getPersonWithFallback(pubkey).petnames).type("p").values().all()

View File

@ -8,7 +8,7 @@
import Content from "src/partials/Content.svelte"
import BorderLeft from "src/partials/BorderLeft.svelte"
import PersonInfo from "src/app/shared/PersonInfo.svelte"
import {sampleRelays} from "src/agent/relays"
import {sampleRelays, getUserReadRelays} from "src/agent/relays"
import network from "src/agent/network"
import {watch} from "src/agent/db"
import user from "src/agent/user"
@ -20,11 +20,18 @@
}
const loadPeople = debounce(500, search => {
// If we have a query, search using nostr.band. If not, ask for random profiles.
// This allows us to populate results even if search isn't supported by forced urls
if (q.length > 2) {
network.load({
relays: sampleRelays([{url: "wss://relay.nostr.band"}]),
filter: [{kinds: [0], search, limit: 10}],
})
} else {
network.load({
relays: getUserReadRelays(),
filter: [{kinds: [0], limit: 50}],
})
}
})

View File

@ -101,11 +101,8 @@ export const theme = synced("ui/theme", prefersDark ? "dark" : "light")
export const getThemeColors = $theme => {
for (const x of range(1, 10)) {
// const lum = $theme === 'dark' ? (x - 5) * 30 : (4 - x) * 30
const lum = $theme === "dark" ? (5 - x) * 25 : (x - 5) * 25
console.log(lum, shadeColor(THEME[`gray-${$theme}`], lum))
THEME[`gray-${x}`] = shadeColor(THEME[`gray-${$theme}`], lum)
}

View File

@ -6,8 +6,6 @@ import sveltePreprocess from "svelte-preprocess"
import {svelte} from "@sveltejs/vite-plugin-svelte"
import {nodePolyfills} from "vite-plugin-node-polyfills"
console.log(process.env.VITE_APP_NAME)
export default defineConfig({
server: {
https: false,