Alpha.8 + Database

Adding DB for POAPS + Matomo Tracking
This commit is contained in:
Tanner
2025-03-13 10:35:47 -07:00
committed by GitHub
20 changed files with 1398 additions and 513 deletions

2
.gitignore vendored
View File

@@ -4,5 +4,5 @@
.idea
build
.env
poaps.txt
rs/**/target
firebase-admin.json

1316
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -38,6 +38,7 @@
"dotenv": "^16.4.5",
"express": "^4.21.1",
"fast-deep-equal": "^3.1.3",
"firebase-admin": "^13.1.0",
"isomorphic-fetch": "^3.0.0",
"node-loader": "^2.0.0",
"nodemon": "^3.1.7",
@@ -52,7 +53,7 @@
"redux-thunk": "^2.4.2",
"stream-browserify": "^3.0.0",
"tailwindcss": "^3.4.13",
"tlsn-js": "^0.1.0-alpha.7.1"
"tlsn-js": "^0.1.0-alpha.8"
},
"devDependencies": {
"@babel/core": "^7.25.2",

Binary file not shown.

View File

@@ -1,26 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aes"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher",
"cpufeatures",
]
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
version = 4
[[package]]
name = "android-tzdata"
@@ -129,26 +109,6 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytemuck"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
]
[[package]]
name = "byteorder"
version = "1.5.0"
@@ -184,26 +144,6 @@ dependencies = [
"windows-targets",
]
[[package]]
name = "cipher"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"crypto-common",
"inout",
]
[[package]]
name = "clmul"
version = "0.1.0"
source = "git+https://github.com/privacy-scaling-explorations/mpz?rev=b8ae7ac#b8ae7acd4e0f306f0c23a9108dd5b802419e48fd"
dependencies = [
"bytemuck",
"cfg-if",
"cpufeatures",
]
[[package]]
name = "const-oid"
version = "0.9.6"
@@ -231,31 +171,6 @@ dependencies = [
"libc",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "crunchy"
version = "0.2.2"
@@ -284,41 +199,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "darling"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 1.0.109",
]
[[package]]
name = "darling_macro"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core",
"quote",
"syn 1.0.109",
]
[[package]]
name = "der"
version = "0.7.9"
@@ -330,68 +210,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "derive_builder"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3"
dependencies = [
"derive_builder_macro 0.11.2",
]
[[package]]
name = "derive_builder"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
dependencies = [
"derive_builder_macro 0.12.0",
]
[[package]]
name = "derive_builder_core"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "derive_builder_core"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "derive_builder_macro"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68"
dependencies = [
"derive_builder_core 0.11.2",
"syn 1.0.109",
]
[[package]]
name = "derive_builder_macro"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
dependencies = [
"derive_builder_core 0.12.0",
"syn 1.0.109",
]
[[package]]
name = "digest"
version = "0.10.7"
@@ -419,12 +237,6 @@ dependencies = [
"spki",
]
[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "elliptic-curve"
version = "0.13.8"
@@ -456,12 +268,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "futures"
version = "0.3.31"
@@ -518,7 +324,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]
@@ -569,10 +375,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@@ -624,21 +428,6 @@ dependencies = [
"cc",
]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "inout"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
dependencies = [
"generic-array",
]
[[package]]
name = "itoa"
version = "1.0.11"
@@ -702,79 +491,6 @@ version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mpz-circuits"
version = "0.1.0"
source = "git+https://github.com/privacy-scaling-explorations/mpz?rev=b8ae7ac#b8ae7acd4e0f306f0c23a9108dd5b802419e48fd"
dependencies = [
"bincode",
"itybity",
"mpz-circuits-macros",
"once_cell",
"rand",
"regex",
"serde",
"serde_arrays",
"sha2",
"thiserror",
]
[[package]]
name = "mpz-circuits-macros"
version = "0.1.0"
source = "git+https://github.com/privacy-scaling-explorations/mpz?rev=b8ae7ac#b8ae7acd4e0f306f0c23a9108dd5b802419e48fd"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "mpz-core"
version = "0.1.0"
source = "git+https://github.com/privacy-scaling-explorations/mpz?rev=b8ae7ac#b8ae7acd4e0f306f0c23a9108dd5b802419e48fd"
dependencies = [
"aes",
"bcs",
"blake3",
"bytemuck",
"cfg-if",
"cipher",
"clmul",
"generic-array",
"itybity",
"once_cell",
"opaque-debug",
"rand",
"rand_chacha",
"rand_core",
"rayon",
"serde",
"thiserror",
]
[[package]]
name = "mpz-garble-core"
version = "0.1.0"
source = "git+https://github.com/privacy-scaling-explorations/mpz?rev=b8ae7ac#b8ae7acd4e0f306f0c23a9108dd5b802419e48fd"
dependencies = [
"aes",
"blake3",
"cipher",
"derive_builder 0.11.2",
"itybity",
"mpz-circuits",
"mpz-core",
"once_cell",
"opaque-debug",
"rand",
"rand_chacha",
"rand_core",
"serde",
"serde_arrays",
"thiserror",
]
[[package]]
name = "neon"
version = "1.0.0"
@@ -797,7 +513,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b"
dependencies = [
"quote",
"syn 2.0.79",
"syn",
"syn-mid",
]
@@ -933,55 +649,6 @@ dependencies = [
"getrandom",
]
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]]
name = "regex"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rfc6979"
version = "0.4.0"
@@ -1083,15 +750,6 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde_arrays"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38636132857f68ec3d5f3eb121166d2af33cb55174c4d5ff645db6165cbef0fd"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.210"
@@ -1100,7 +758,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]
@@ -1183,29 +841,12 @@ dependencies = [
"der",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.79"
@@ -1225,7 +866,7 @@ checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]
@@ -1245,7 +886,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]
@@ -1259,23 +900,19 @@ dependencies = [
[[package]]
name = "tlsn-core"
version = "0.1.0-alpha.7"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.7#4d5102b6e141ecb84b8a835604be1d285ae6eaa5"
version = "0.1.0-alpha.8"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.8#d8747d49e304fa7a39a682c4a78745fb325efd6c"
dependencies = [
"bcs",
"bimap",
"blake3",
"derive_builder 0.12.0",
"getrandom",
"itybity",
"k256",
"mpz-circuits",
"mpz-core",
"mpz-garble-core",
"opaque-debug",
"p256",
"rand",
"rand_chacha",
"rand_core",
"ring",
"rs_merkle",
"serde",
"sha2",
@@ -1289,8 +926,8 @@ dependencies = [
[[package]]
name = "tlsn-tls-core"
version = "0.1.0-alpha.7"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.7#4d5102b6e141ecb84b8a835604be1d285ae6eaa5"
version = "0.1.0-alpha.8"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.8#d8747d49e304fa7a39a682c4a78745fb325efd6c"
dependencies = [
"futures",
"hmac",
@@ -1309,7 +946,7 @@ dependencies = [
[[package]]
name = "tlsn-utils"
version = "0.1.0"
source = "git+https://github.com/tlsnotary/tlsn-utils?rev=e7b2db6#e7b2db6a0c0d0202694754efb77625ee43a14f5a"
source = "git+https://github.com/tlsnotary/tlsn-utils?rev=425614e#425614e45783946d1636ff629ffade549e4e1426"
dependencies = [
"serde",
]
@@ -1333,7 +970,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]
@@ -1412,7 +1049,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
"wasm-bindgen-shared",
]
@@ -1434,7 +1071,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -1574,7 +1211,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn",
]
[[package]]

View File

@@ -19,4 +19,4 @@ serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0"
hex = "0.4"
bincode = { version = "1.3" }
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.7", package = "tlsn-core" }
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.8", package = "tlsn-core" }

BIN
rs/0.1.0-alpha.8/index.node Executable file

Binary file not shown.

View File

@@ -5,11 +5,11 @@ import { StaticRouter } from 'react-router-dom/server';
import App from '../web/pages/App';
import configureAppStore, { AppRootState } from '../web/store';
import { Provider } from 'react-redux';
import { getPoapLink } from './util/index';
import { Mutex } from 'async-mutex';
//@ts-ignore
import { verify } from '../rs/0.1.0-alpha.7/index.node';
import { verify } from '../rs/0.1.0-alpha.8/index.node';
import { convertNotaryWsToHttp, fetchPublicKeyFromNotary } from './util/index';
import { assignPoapToUser } from './util/index';
const app = express();
const port = 3030;
@@ -110,21 +110,23 @@ app.get('*', (req, res) => {
app.post('/poap-claim', async (req, res) => {
const { screenName } = req.body;
if (!screenName) {
return res.status(400).send('Missing screen_name');
return res.status(400).json({ error: 'Missing screen_name' });
}
try {
await mutex.runExclusive(async () => {
const poapLink = getPoapLink(screenName);
const poapLink = await assignPoapToUser(screenName);
if (!poapLink) {
return res.status(500).send('No more POAP links available');
return res.status(404).json({ error: 'No POAPs available' });
}
res.json({ poapLink });
return res.json({ poapLink });
});
} catch (e) {
console.error(e);
res.status(500).send('Error generating POAP link');
} catch (error) {
console.error('Error claiming POAP:', error);
return res.status(500).json({ error: 'Internal server error' });
}
});
@@ -133,11 +135,14 @@ app.post('/verify-attestation', async (req, res) => {
if (!attestation) {
return res.status(400).send('Missing attestation');
}
console.log(attestation);
try {
const notaryUrl = convertNotaryWsToHttp(attestation.meta.notaryUrl);
console.log(notaryUrl);
const notaryPem = await fetchPublicKeyFromNotary(notaryUrl);
console.log(notaryPem);
const presentation = await verify(attestation.data, notaryPem);
console.log(presentation);
const presentationObj = {
sent: presentation.sent,
recv: presentation.recv,

View File

@@ -1,3 +0,0 @@
{
}

View File

@@ -1,44 +1,16 @@
import path from 'path';
import fs from 'fs';
import { localPem } from '../../web/utils/constants';
import admin from 'firebase-admin';
const poapLinksPath = path.join(__dirname, 'util', 'poaps.txt');
const assignmentsFilePath = path.join(__dirname, 'util', 'assignments.json');
const serviceAccount = JSON.parse(
fs.readFileSync(path.join(__dirname, 'util/firebase-admin.json'), 'utf8')
);
export const loadPoapLinks = (): string[] => {
const fileContent = fs.readFileSync(poapLinksPath, 'utf-8');
return fileContent.trim().split('\n');
};
export const loadAssignments = (): Record<string, string> => {
if (fs.existsSync(assignmentsFilePath)) {
const fileContent = fs.readFileSync(assignmentsFilePath, 'utf-8');
return JSON.parse(fileContent);
}
return {};
};
export const saveAssignments = (assignments: Record<string, string>) => {
fs.writeFileSync(assignmentsFilePath, JSON.stringify(assignments, null, 2));
};
export const getPoapLink = (screenName: string): string | null => {
const poapLinks = loadPoapLinks();
const assignments = loadAssignments();
if (assignments[screenName]) {
return assignments[screenName];
}
if (poapLinks.length === 0) {
return null;
}
const newLink = poapLinks.shift();
assignments[screenName] = newLink as string;
saveAssignments(assignments);
fs.writeFileSync(poapLinksPath, poapLinks.join('\n'));
return newLink || null;
};
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
const db = admin.firestore();
export function convertNotaryWsToHttp(notaryWs: string) {
const { protocol, pathname, hostname, port } = new URL(notaryWs);
@@ -63,3 +35,67 @@ export async function fetchPublicKeyFromNotary(notaryUrl: string) {
return null;
}
}
export const getUserPoap = async (
screen_name: string,
): Promise<string | null> => {
const assignmentRef = db.collection('poapAssignments').doc(screen_name);
const assignmentSnap = await assignmentRef.get();
if (assignmentSnap.exists) {
return assignmentSnap.data()?.poapLink || null;
}
return null;
};
export const assignPoapToUser = async (screen_name: string): Promise<string | null> => {
const existingPoap = await getUserPoap(screen_name);
if (existingPoap) return existingPoap;
const poapsDocRef = db.collection("poaps").doc("poaps");
const poapsDoc = await poapsDocRef.get();
if (!poapsDoc.exists) {
console.error("POAPs document not found in Firestore.");
return null;
}
const poapsData = poapsDoc.data()?.links || {};
const poapKeys = Object.keys(poapsData);
if (poapKeys.length === 0) {
console.log("No available POAPs left.");
return null;
}
const firstKey = poapKeys[0];
const poapLink = poapsData[firstKey];
if (!poapLink) {
console.error("Invalid POAP link found:", poapsData);
return null;
}
try {
const batch = db.batch();
const assignmentRef = db.collection("poapAssignments").doc(screen_name);
batch.set(assignmentRef, {
poapLink,
screen_name,
assignedAt: admin.firestore.FieldValue.serverTimestamp(),
});
batch.update(poapsDocRef, {
[`links.${firstKey}`]: admin.firestore.FieldValue.delete(),
});
await batch.commit();
return poapLink;
} catch (error) {
console.error("Error writing to Firestore:", error);
return null;
}
};

View File

@@ -1 +0,0 @@
https://poap.xyz/mint/xxxxxx

View File

@@ -0,0 +1,35 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
declare global {
interface Window {
_paq?: any[];
}
}
const MatomoTracking = () => {
const location = useLocation();
useEffect(() => {
if (typeof window !== 'undefined') {
var _paq = (window._paq = window._paq || []);
_paq.push(['setTrackerUrl', 'https://psedev.matomo.cloud/matomo.php']);
_paq.push(['setSiteId', '16']);
let script = document.createElement('script');
script.async = true;
script.src = 'https://cdn.matomo.cloud/psedev.matomo.cloud/matomo.js';
document.head.appendChild(script);
}
}, []);
useEffect(() => {
if (typeof window !== 'undefined' && window._paq) {
window._paq.push(['setCustomUrl', window.location.pathname]);
window._paq.push(['trackPageView']);
}
}, [location.pathname]);
return null;
};
export default MatomoTracking;

View File

@@ -76,10 +76,13 @@ export default function Steps(): ReactElement {
async function handleGetPlugins() {
try {
const plugins = await client.getPlugins('**', '**');
const targetPlugin = plugins.find((plugin: any) =>
plugin.title === "Twitter Profile" &&
Array.isArray(plugin.headers) &&
plugin.headers.includes('https://api.x.com/1.1/account/settings.json')
const targetPlugin = plugins.find(
(plugin: any) =>
plugin.title === 'Twitter Profile' &&
Array.isArray(plugin.headers) &&
plugin.headers.includes(
'https://api.x.com/1.1/account/settings.json',
),
);
if (targetPlugin) {
@@ -91,7 +94,6 @@ export default function Steps(): ReactElement {
}
}
async function handlePluginInstall() {
try {
const plugin = await client.installPlugin(

View File

@@ -3,11 +3,13 @@ import { Routes, Route } from 'react-router-dom';
import Header from '../../components/Header';
import Body from '../../components/Body';
import './index.scss';
import MatomoTracking from '../../components/MatomoTracking';
export default function App(): ReactElement {
return (
<div className="app flex flex-col gap-4">
<Header />
<MatomoTracking />
<Routes>
<Route path="/" element={<Body />} />
</Routes>

View File

@@ -87,8 +87,7 @@ const options = {
new webpack.EnvironmentPlugin(['NODE_ENV']),
new CopyWebpackPlugin({
patterns: [
{ from: 'server/util/poaps.txt', to: 'util/' },
{ from: 'server/util/assignments.json', to: 'util/' }
{ from: 'server/util/firebase-admin.json', to: 'util/' },
],
}),
new CompressionPlugin({