[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

add github actions for checking appview (#24)

authored by

Davi Rodrigues and committed by
GitHub
24a7b52e fecff8f8

+105 -3
+93
.github/workflows/lint-prs.yaml
··· 1 + name: Deno AppView Service Check 2 + 3 + on: 4 + pull_request: 5 + branches: [main] 6 + types: [opened, synchronize, reopened] 7 + 8 + jobs: 9 + format: 10 + runs-on: ubuntu-latest 11 + steps: 12 + - uses: actions/checkout@v4 13 + with: 14 + fetch-depth: 0 15 + 16 + - name: Get changed AppView files 17 + id: changed_files 18 + uses: tj-actions/changed-files@v46 19 + with: 20 + files: | 21 + services/appview/**/*.ts 22 + services/appview/**/*.js 23 + services/appview/**/*.json 24 + services/appview/**/deno.json 25 + services/appview/**/deno.lock 26 + 27 + - uses: denoland/setup-deno@v2 28 + if: steps.changed_files.outputs.all_changed_files != '' 29 + with: 30 + deno-version: v2.x 31 + cache: true 32 + 33 + - name: Check formatting 34 + if: steps.changed_files.outputs.all_changed_files != '' 35 + run: deno fmt --check --ignore=lexicon ${{ steps.changed_files.outputs.all_changed_files }} 36 + 37 + lint: 38 + runs-on: ubuntu-latest 39 + steps: 40 + - uses: actions/checkout@v4 41 + with: 42 + fetch-depth: 0 43 + 44 + - name: Get changed AppView files 45 + id: changed_files 46 + uses: tj-actions/changed-files@v46 47 + with: 48 + files: | 49 + services/appview/**/*.ts 50 + services/appview/**/*.js 51 + services/appview/**/*.json 52 + services/appview/**/deno.json 53 + services/appview/**/deno.lock 54 + 55 + - uses: denoland/setup-deno@v2 56 + if: steps.changed_files.outputs.all_changed_files != '' 57 + with: 58 + deno-version: v2.x 59 + cache: true 60 + 61 + - name: Lint 62 + if: steps.changed_files.outputs.all_changed_files != '' 63 + working-directory: services/appview 64 + run: deno lint 65 + 66 + test: 67 + runs-on: ubuntu-latest 68 + steps: 69 + - uses: actions/checkout@v4 70 + with: 71 + fetch-depth: 0 72 + 73 + - name: Get changed AppView files 74 + id: changed_files 75 + uses: tj-actions/changed-files@v46 76 + with: 77 + files: | 78 + services/appview/**/*.ts 79 + services/appview/**/*.js 80 + services/appview/**/*.json 81 + services/appview/**/deno.json 82 + services/appview/**/deno.lock 83 + 84 + - uses: denoland/setup-deno@v2 85 + if: steps.changed_files.outputs.all_changed_files != '' 86 + with: 87 + deno-version: v2.x 88 + cache: true 89 + 90 + - name: Test 91 + if: steps.changed_files.outputs.all_changed_files != '' 92 + working-directory: services/appview 93 + run: deno test --allow-all
+1 -1
services/appview/data-plane/server/index.ts
··· 1 1 import mongoose, { Connection, Document, Model, Schema } from "mongoose"; 2 2 import { pino } from "pino"; 3 3 import { IdResolver, MemoryCache } from "@atproto/identity"; 4 - import { env } from "../../../utils/env.ts"; 4 + import { env } from "../../utils/env.ts"; 5 5 import { DataPlaneClient, GetIdentityByDidResponse } from "../client/index.ts"; 6 6 import { DidDocument } from "@atproto/identity"; 7 7 import { Buffer } from "node:buffer";
+10 -1
services/appview/main_test.ts
··· 7 7 MOD_SERVICE_DID: "did:web:test", 8 8 ADMIN_PASSWORD: "test", 9 9 }; 10 + 11 + Deno.env.set("SERVICE_DID", "did:web:test"); 12 + Deno.env.set("MOD_SERVICE_DID", "did:web:test"); 13 + Deno.env.set("ADMIN_PASSWORD", "test"); 14 + Deno.env.set( 15 + "APPVIEW_K256_PRIVATE_KEY_HEX", 16 + "5676df35fd3a185a1771a43536635ad90057e0c0d1fd91436344bb50ce23a460", // random valid test key 17 + ); 18 + 10 19 Deno.test("Server Running", async () => { 11 20 const res = await app.request("/", { 12 21 headers: { ··· 29 38 new RegExp( 30 39 [ 31 40 "^\\{", 32 - '"@context":\\["https://www\\.w3\\.org/ns/did/v1"\\],', 41 + '"@context":\\["https://www\\.w3\\.org/ns/did/v1","https://w3id\\.org/security/multikey/v1"\\],', 33 42 '"id":"(did:web:[^"]+)",', 34 43 '"verificationMethod":\\[\\{', 35 44 '"id":"\\1#atproto",',
+1 -1
services/appview/utils/well-known.ts
··· 8 8 router.get("/.well-known/did.json", async (c) => { 9 9 const domain = env.PUBLIC_URL?.split("://")[1] || "localhost"; 10 10 const keypair = await Secp256k1Keypair.import( 11 - env.APPVIEW_K256_PRIVATE_KEY_HEX, 11 + Deno.env.get("APPVIEW_K256_PRIVATE_KEY_HEX") || "", 12 12 ); 13 13 const multikey = formatMultikey(keypair.jwtAlg, keypair.publicKeyBytes()); 14 14