mirror of
https://github.com/minimo-io/appticles.git
synced 2025-06-23 16:05:29 +00:00
Remove sveltekit, and typescript with ts-ignore for now
This commit is contained in:
parent
776a2afe06
commit
dbe86b8622
24
nostr-followback/.gitignore
vendored
Normal file
24
nostr-followback/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
@ -11,7 +11,4 @@ Let promote some reciprocity here! 😹
|
|||||||
- Configure Vite for the miniapp to be loaded in the article's url as base.
|
- Configure Vite for the miniapp to be loaded in the article's url as base.
|
||||||
- Save followbackers and not followbackers in lists to see details.
|
- Save followbackers and not followbackers in lists to see details.
|
||||||
- Create an UI/UX that's worth looking at.
|
- Create an UI/UX that's worth looking at.
|
||||||
|
|
||||||
## v2
|
|
||||||
|
|
||||||
- Upload a localStorage list of relays
|
- Upload a localStorage list of relays
|
||||||
|
12
nostr-followback/index.html
Normal file
12
nostr-followback/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Vite + Svelte + TS</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,21 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "test-nostr-reciprocal",
|
"name": "nostr-followback",
|
||||||
"version": "0.0.1",
|
"private": true,
|
||||||
"private": true,
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"type": "module",
|
||||||
"dev": "vite dev",
|
"scripts": {
|
||||||
"build": "vite build",
|
"dev": "vite",
|
||||||
"preview": "vite preview"
|
"build": "vite build",
|
||||||
},
|
"preview": "vite preview",
|
||||||
"devDependencies": {
|
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||||
"@sveltejs/adapter-auto": "^3.0.0",
|
},
|
||||||
"@sveltejs/kit": "^2.0.0",
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
||||||
"svelte": "^4.2.7",
|
"@tsconfig/svelte": "^5.0.2",
|
||||||
"vite": "^5.0.3"
|
"svelte": "^4.2.12",
|
||||||
},
|
"svelte-check": "^3.6.7",
|
||||||
"type": "module",
|
"tslib": "^2.6.2",
|
||||||
"dependencies": {
|
"typescript": "^5.2.2",
|
||||||
"@nostr-dev-kit/ndk": "^2.7.1"
|
"vite": "^5.2.0"
|
||||||
}
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nostr-dev-kit/ndk": "^2.8.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
|
// @ts-nocheck
|
||||||
// Import the package
|
// Import the package
|
||||||
import NDK from "@nostr-dev-kit/ndk";
|
import NDK from "@nostr-dev-kit/ndk";
|
||||||
import { fetchUserProfile } from "$lib/fetchs";
|
import { fetchUserProfile } from "./lib/fetchs";
|
||||||
import { relays } from "$lib/data/relays";
|
import { relays } from "./lib/data/relays";
|
||||||
|
|
||||||
// let npubToQuery = "npub1wujhdsytm3w6g0mpsqh8v7ezx83jcm64dlkwuqgm5v8lv0pds55ssudkw0";
|
// let npubToQuery = "npub1wujhdsytm3w6g0mpsqh8v7ezx83jcm64dlkwuqgm5v8lv0pds55ssudkw0";
|
||||||
let npubToQuery = "";
|
let npubToQuery = "";
|
||||||
let querying = false;
|
let querying = false;
|
||||||
let userName = "";
|
let userName = "";
|
||||||
let userThumb = "";
|
let userThumb = "";
|
||||||
let followsCount;
|
let followsCount = 0;
|
||||||
|
|
||||||
let followBackCount = 0;
|
let followBackCount = 0;
|
||||||
let notFollowBackCount = 0;
|
let notFollowBackCount = 0;
|
||||||
@ -128,18 +129,23 @@
|
|||||||
User: {userName} | Follows: {followsCount}
|
User: {userName} | Follows: {followsCount}
|
||||||
<br />
|
<br />
|
||||||
{npubToQuery}
|
{npubToQuery}
|
||||||
<br /><br />
|
<br />
|
||||||
Unknown: {unknownFollowBack} | Follow_Back: {followBackCount} | <strong>Not_Follow_Back</strong>:
|
<br />
|
||||||
|
Unknown: {unknownFollowBack} | Follow_Back: {followBackCount} |
|
||||||
|
<strong>Not_Follow_Back</strong>
|
||||||
|
:
|
||||||
<span title="Actually Counted">{notFollowBackCount}</span>
|
<span title="Actually Counted">{notFollowBackCount}</span>
|
||||||
/ <span title="Actualy counted">{notFollowersBack.length}</span>
|
/
|
||||||
|
<span title="Actualy counted">{notFollowersBack.length}</span>
|
||||||
<br />
|
<br />
|
||||||
{#if progress < 100}
|
{#if progress < 100}
|
||||||
<p>
|
<p>
|
||||||
Progress =
|
Progress =
|
||||||
<strong>{progress}%</strong> - {totalCountOfContactsChecked} of {followsCount}
|
<strong>{progress}%</strong>
|
||||||
|
- {totalCountOfContactsChecked} of {followsCount}
|
||||||
<!-- - {totalCountOfContactsChecked} of {followBackCount +
|
<!-- - {totalCountOfContactsChecked} of {followBackCount +
|
||||||
notFollowBackCount +
|
notFollowBackCount +
|
||||||
unknownFollowBack} -->
|
unknownFollowBack} -->
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p><strong>Completed!</strong></p>
|
<p><strong>Completed!</strong></p>
|
||||||
@ -159,19 +165,19 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
<!-- <br />
|
<!-- <br />
|
||||||
<strong>They don't follow you ({notFollowersBack.length}):</strong>
|
<strong>They don't follow you ({notFollowersBack.length}):</strong>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{#each notFollowersBack as item, i (item)}
|
{#each notFollowersBack as item, i (item)}
|
||||||
<li>
|
<li>
|
||||||
#{i + 1} - <a href="https://nostr.band/{item}" target="_blank noreferrer noopener">Nostr.Band</a>
|
#{i + 1} - <a href="https://nostr.band/{item}" target="_blank noreferrer noopener">Nostr.Band</a>
|
||||||
/ <a href="https://primal.net/p/{item}" target="_blank noreferrer noopener">Primal</a>
|
/ <a href="https://primal.net/p/{item}" target="_blank noreferrer noopener">Primal</a>
|
||||||
:
|
:
|
||||||
{item}
|
{item}
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul> -->
|
</ul> -->
|
||||||
</div>
|
</div>
|
||||||
{:else if !querying}
|
{:else if !querying}
|
||||||
<p>Let's find out who does not follow you back in Nostr!</p>
|
<p>Let's find out who does not follow you back in Nostr!</p>
|
79
nostr-followback/src/app.css
Normal file
79
nostr-followback/src/app.css
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
max-width: 1280px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
%sveltekit.head%
|
|
||||||
</head>
|
|
||||||
<body data-sveltekit-preload-data="hover">
|
|
||||||
<div style="display: contents">%sveltekit.body%</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
8
nostr-followback/src/main.ts
Normal file
8
nostr-followback/src/main.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import './app.css'
|
||||||
|
import App from './App.svelte'
|
||||||
|
|
||||||
|
const app = new App({
|
||||||
|
target: document.getElementById('app')!,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default app
|
@ -1,56 +0,0 @@
|
|||||||
<script>
|
|
||||||
import NDK from "@nostr-dev-kit/ndk";
|
|
||||||
import { fetchUserProfile } from "$lib/fetchs.js";
|
|
||||||
import { relays } from "$lib/data/relays";
|
|
||||||
|
|
||||||
let npubToQuery = "npub1fyjqppvxj9z8km5c9hmyfvvnrqj8qxcz82av3dse57v3lftvhz3q98p6ma";
|
|
||||||
let userName;
|
|
||||||
let userThumb;
|
|
||||||
let followsCount;
|
|
||||||
let listOfFollows = [];
|
|
||||||
async function init() {
|
|
||||||
try {
|
|
||||||
const ndk = new NDK({
|
|
||||||
explicitRelayUrls: relays,
|
|
||||||
});
|
|
||||||
await ndk.connect();
|
|
||||||
|
|
||||||
const user = await fetchUserProfile(npubToQuery, ndk);
|
|
||||||
userName = user.profile.name;
|
|
||||||
userThumb = user.profile.image;
|
|
||||||
|
|
||||||
if (userName) {
|
|
||||||
const follows = await user.follows();
|
|
||||||
followsCount = follows.size;
|
|
||||||
if (follows.size) {
|
|
||||||
follows.forEach((contact) => {
|
|
||||||
listOfFollows.push(contact.npub);
|
|
||||||
listOfFollows = listOfFollows;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching data:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<h3>This npub follows:</h3>
|
|
||||||
{#if userThumb}
|
|
||||||
<a target="_blank noreferrer noopener" href="https://primal.net/p/{npubToQuery}"
|
|
||||||
><img src={userThumb} width="50" style="border-radius:100%;" alt="user-thumb" /></a
|
|
||||||
>
|
|
||||||
User: <a target="_blank noreferrer noopener" href="https://primal.net/p/{npubToQuery}">{userName}</a> | Follows: {followsCount}
|
|
||||||
{:else}
|
|
||||||
<div class="loader">Loading data for... {npubToQuery}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<br /><br />
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{#each listOfFollows as item}
|
|
||||||
<li>{item}</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
2
nostr-followback/src/vite-env.d.ts
vendored
Normal file
2
nostr-followback/src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/// <reference types="svelte" />
|
||||||
|
/// <reference types="vite/client" />
|
Binary file not shown.
Before ![]() (image error) Size: 1.5 KiB |
@ -1,13 +1,7 @@
|
|||||||
import adapter from '@sveltejs/adapter-auto';
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
export default {
|
||||||
const config = {
|
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
||||||
kit: {
|
// for more information about preprocessors
|
||||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
preprocess: vitePreprocess(),
|
||||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
}
|
||||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
|
||||||
adapter: adapter()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
|
20
nostr-followback/tsconfig.json
Normal file
20
nostr-followback/tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
/**
|
||||||
|
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||||
|
* Disable checkJs if you'd like to use dynamic types in JS.
|
||||||
|
* Note that setting allowJs false does not prevent the use
|
||||||
|
* of JS in `.svelte` files.
|
||||||
|
*/
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"isolatedModules": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
||||||
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
|
}
|
10
nostr-followback/tsconfig.node.json
Normal file
10
nostr-followback/tsconfig.node.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [sveltekit()]
|
|
||||||
});
|
|
7
nostr-followback/vite.config.ts
Normal file
7
nostr-followback/vite.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [svelte()],
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user