grain.social is a photo sharing platform built on atproto.

refactor: move appview related code into /appview folder

Changed files
+99 -3
appview
__generated__
src
api
components
lib
modules
routes
static
static
services
darkroom
.dockerignore appview/.dockerignore
.env.example appview/.env.example
-1
.gitignore
··· 2 2 *.db* 3 3 .DS_Store 4 4 *.fly.toml 5 - image_storage 6 5 .env 7 6 grain-root.crt 8 7 *.log
Dockerfile appview/Dockerfile
README.md appview/README.md
+22
__generated__/index.ts appview/__generated__/index.ts
··· 26 26 import * as SocialGrainGraphCreateFollow from './types/social/grain/graph/createFollow.ts' 27 27 import * as SocialGrainGraphGetFollowers from './types/social/grain/graph/getFollowers.ts' 28 28 import * as SocialGrainGraphGetFollows from './types/social/grain/graph/getFollows.ts' 29 + import * as SocialGrainDarkroomGetGalleryComposite from './types/social/grain/darkroom/getGalleryComposite.ts' 29 30 import * as SocialGrainFavoriteDeleteFavorite from './types/social/grain/favorite/deleteFavorite.ts' 30 31 import * as SocialGrainFavoriteCreateFavorite from './types/social/grain/favorite/createFavorite.ts' 31 32 import * as SocialGrainFeedGetTimeline from './types/social/grain/feed/getTimeline.ts' ··· 213 214 comment: SocialGrainCommentNS 214 215 gallery: SocialGrainGalleryNS 215 216 graph: SocialGrainGraphNS 217 + darkroom: SocialGrainDarkroomNS 216 218 favorite: SocialGrainFavoriteNS 217 219 labeler: SocialGrainLabelerNS 218 220 feed: SocialGrainFeedNS ··· 225 227 this.comment = new SocialGrainCommentNS(server) 226 228 this.gallery = new SocialGrainGalleryNS(server) 227 229 this.graph = new SocialGrainGraphNS(server) 230 + this.darkroom = new SocialGrainDarkroomNS(server) 228 231 this.favorite = new SocialGrainFavoriteNS(server) 229 232 this.labeler = new SocialGrainLabelerNS(server) 230 233 this.feed = new SocialGrainFeedNS(server) ··· 448 451 >, 449 452 ) { 450 453 const nsid = 'social.grain.graph.getFollows' // @ts-ignore 454 + return this._server.xrpc.method(nsid, cfg) 455 + } 456 + } 457 + 458 + export class SocialGrainDarkroomNS { 459 + _server: Server 460 + 461 + constructor(server: Server) { 462 + this._server = server 463 + } 464 + 465 + getGalleryComposite<AV extends AuthVerifier>( 466 + cfg: ConfigOf< 467 + AV, 468 + SocialGrainDarkroomGetGalleryComposite.Handler<ExtractAuth<AV>>, 469 + SocialGrainDarkroomGetGalleryComposite.HandlerReqCtx<ExtractAuth<AV>> 470 + >, 471 + ) { 472 + const nsid = 'social.grain.darkroom.getGalleryComposite' // @ts-ignore 451 473 return this._server.xrpc.method(nsid, cfg) 452 474 } 453 475 }
+28
__generated__/lexicons.ts appview/__generated__/lexicons.ts
··· 3556 3556 }, 3557 3557 }, 3558 3558 }, 3559 + SocialGrainDarkroomGetGalleryComposite: { 3560 + lexicon: 1, 3561 + id: 'social.grain.darkroom.getGalleryComposite', 3562 + defs: { 3563 + main: { 3564 + type: 'query', 3565 + description: 3566 + 'Returns a composite image for a specified gallery AT-URI.', 3567 + parameters: { 3568 + type: 'params', 3569 + required: ['uri'], 3570 + properties: { 3571 + uri: { 3572 + type: 'string', 3573 + description: 3574 + 'The AT-URI of the gallery to return a composite for.', 3575 + format: 'at-uri', 3576 + }, 3577 + }, 3578 + }, 3579 + output: { 3580 + encoding: '*/*', 3581 + }, 3582 + }, 3583 + }, 3584 + }, 3559 3585 SocialGrainFavoriteDeleteFavorite: { 3560 3586 lexicon: 1, 3561 3587 id: 'social.grain.favorite.deleteFavorite', ··· 5050 5076 SocialGrainGraphCreateFollow: 'social.grain.graph.createFollow', 5051 5077 SocialGrainGraphGetFollowers: 'social.grain.graph.getFollowers', 5052 5078 SocialGrainGraphGetFollows: 'social.grain.graph.getFollows', 5079 + SocialGrainDarkroomGetGalleryComposite: 5080 + 'social.grain.darkroom.getGalleryComposite', 5053 5081 SocialGrainFavoriteDeleteFavorite: 'social.grain.favorite.deleteFavorite', 5054 5082 SocialGrainFavoriteCreateFavorite: 'social.grain.favorite.createFavorite', 5055 5083 SocialGrainFavorite: 'social.grain.favorite',
__generated__/types/app/bsky/actor/defs.ts appview/__generated__/types/app/bsky/actor/defs.ts
__generated__/types/app/bsky/actor/profile.ts appview/__generated__/types/app/bsky/actor/profile.ts
__generated__/types/app/bsky/embed/defs.ts appview/__generated__/types/app/bsky/embed/defs.ts
__generated__/types/app/bsky/embed/external.ts appview/__generated__/types/app/bsky/embed/external.ts
__generated__/types/app/bsky/embed/images.ts appview/__generated__/types/app/bsky/embed/images.ts
__generated__/types/app/bsky/embed/record.ts appview/__generated__/types/app/bsky/embed/record.ts
__generated__/types/app/bsky/embed/recordWithMedia.ts appview/__generated__/types/app/bsky/embed/recordWithMedia.ts
__generated__/types/app/bsky/embed/video.ts appview/__generated__/types/app/bsky/embed/video.ts
__generated__/types/app/bsky/feed/defs.ts appview/__generated__/types/app/bsky/feed/defs.ts
__generated__/types/app/bsky/feed/postgate.ts appview/__generated__/types/app/bsky/feed/postgate.ts
__generated__/types/app/bsky/feed/threadgate.ts appview/__generated__/types/app/bsky/feed/threadgate.ts
__generated__/types/app/bsky/graph/defs.ts appview/__generated__/types/app/bsky/graph/defs.ts
__generated__/types/app/bsky/graph/follow.ts appview/__generated__/types/app/bsky/graph/follow.ts
__generated__/types/app/bsky/labeler/defs.ts appview/__generated__/types/app/bsky/labeler/defs.ts
__generated__/types/app/bsky/richtext/facet.ts appview/__generated__/types/app/bsky/richtext/facet.ts
__generated__/types/com/atproto/label/defs.ts appview/__generated__/types/com/atproto/label/defs.ts
__generated__/types/com/atproto/moderation/defs.ts appview/__generated__/types/com/atproto/moderation/defs.ts
__generated__/types/com/atproto/repo/strongRef.ts appview/__generated__/types/com/atproto/repo/strongRef.ts
__generated__/types/sh/tangled/actor/profile.ts appview/__generated__/types/sh/tangled/actor/profile.ts
__generated__/types/sh/tangled/graph/follow.ts appview/__generated__/types/sh/tangled/graph/follow.ts
__generated__/types/social/grain/actor/defs.ts appview/__generated__/types/social/grain/actor/defs.ts
__generated__/types/social/grain/actor/getActorFavs.ts appview/__generated__/types/social/grain/actor/getActorFavs.ts
__generated__/types/social/grain/actor/getProfile.ts appview/__generated__/types/social/grain/actor/getProfile.ts
__generated__/types/social/grain/actor/profile.ts appview/__generated__/types/social/grain/actor/profile.ts
__generated__/types/social/grain/actor/searchActors.ts appview/__generated__/types/social/grain/actor/searchActors.ts
__generated__/types/social/grain/actor/updateAvatar.ts appview/__generated__/types/social/grain/actor/updateAvatar.ts
__generated__/types/social/grain/actor/updateProfile.ts appview/__generated__/types/social/grain/actor/updateProfile.ts
__generated__/types/social/grain/comment.ts appview/__generated__/types/social/grain/comment.ts
__generated__/types/social/grain/comment/createComment.ts appview/__generated__/types/social/grain/comment/createComment.ts
__generated__/types/social/grain/comment/defs.ts appview/__generated__/types/social/grain/comment/defs.ts
__generated__/types/social/grain/comment/deleteComment.ts appview/__generated__/types/social/grain/comment/deleteComment.ts
__generated__/types/social/grain/defs.ts appview/__generated__/types/social/grain/defs.ts
__generated__/types/social/grain/favorite.ts appview/__generated__/types/social/grain/favorite.ts
__generated__/types/social/grain/favorite/createFavorite.ts appview/__generated__/types/social/grain/favorite/createFavorite.ts
__generated__/types/social/grain/favorite/deleteFavorite.ts appview/__generated__/types/social/grain/favorite/deleteFavorite.ts
__generated__/types/social/grain/feed/getTimeline.ts appview/__generated__/types/social/grain/feed/getTimeline.ts
__generated__/types/social/grain/gallery.ts appview/__generated__/types/social/grain/gallery.ts
__generated__/types/social/grain/gallery/applySort.ts appview/__generated__/types/social/grain/gallery/applySort.ts
__generated__/types/social/grain/gallery/createGallery.ts appview/__generated__/types/social/grain/gallery/createGallery.ts
__generated__/types/social/grain/gallery/createItem.ts appview/__generated__/types/social/grain/gallery/createItem.ts
__generated__/types/social/grain/gallery/defs.ts appview/__generated__/types/social/grain/gallery/defs.ts
__generated__/types/social/grain/gallery/deleteGallery.ts appview/__generated__/types/social/grain/gallery/deleteGallery.ts
__generated__/types/social/grain/gallery/deleteItem.ts appview/__generated__/types/social/grain/gallery/deleteItem.ts
__generated__/types/social/grain/gallery/getActorGalleries.ts appview/__generated__/types/social/grain/gallery/getActorGalleries.ts
__generated__/types/social/grain/gallery/getGallery.ts appview/__generated__/types/social/grain/gallery/getGallery.ts
__generated__/types/social/grain/gallery/getGalleryThread.ts appview/__generated__/types/social/grain/gallery/getGalleryThread.ts
__generated__/types/social/grain/gallery/item.ts appview/__generated__/types/social/grain/gallery/item.ts
__generated__/types/social/grain/gallery/updateGallery.ts appview/__generated__/types/social/grain/gallery/updateGallery.ts
__generated__/types/social/grain/graph/createFollow.ts appview/__generated__/types/social/grain/graph/createFollow.ts
__generated__/types/social/grain/graph/deleteFollow.ts appview/__generated__/types/social/grain/graph/deleteFollow.ts
__generated__/types/social/grain/graph/follow.ts appview/__generated__/types/social/grain/graph/follow.ts
__generated__/types/social/grain/graph/getFollowers.ts appview/__generated__/types/social/grain/graph/getFollowers.ts
__generated__/types/social/grain/graph/getFollows.ts appview/__generated__/types/social/grain/graph/getFollows.ts
__generated__/types/social/grain/labeler/defs.ts appview/__generated__/types/social/grain/labeler/defs.ts
__generated__/types/social/grain/labeler/service.ts appview/__generated__/types/social/grain/labeler/service.ts
__generated__/types/social/grain/notification/defs.ts appview/__generated__/types/social/grain/notification/defs.ts
__generated__/types/social/grain/notification/getNotifications.ts appview/__generated__/types/social/grain/notification/getNotifications.ts
__generated__/types/social/grain/notification/updateSeen.ts appview/__generated__/types/social/grain/notification/updateSeen.ts
__generated__/types/social/grain/photo.ts appview/__generated__/types/social/grain/photo.ts
__generated__/types/social/grain/photo/applyAlts.ts appview/__generated__/types/social/grain/photo/applyAlts.ts
__generated__/types/social/grain/photo/createExif.ts appview/__generated__/types/social/grain/photo/createExif.ts
__generated__/types/social/grain/photo/defs.ts appview/__generated__/types/social/grain/photo/defs.ts
__generated__/types/social/grain/photo/deletePhoto.ts appview/__generated__/types/social/grain/photo/deletePhoto.ts
__generated__/types/social/grain/photo/exif.ts appview/__generated__/types/social/grain/photo/exif.ts
__generated__/types/social/grain/photo/getActorPhotos.ts appview/__generated__/types/social/grain/photo/getActorPhotos.ts
__generated__/types/social/grain/photo/uploadPhoto.ts appview/__generated__/types/social/grain/photo/uploadPhoto.ts
__generated__/util.ts appview/__generated__/util.ts
+44
appview/__generated__/types/social/grain/darkroom/getGalleryComposite.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import stream from "node:stream"; 5 + import { HandlerAuth, HandlerPipeThrough } from "npm:@atproto/xrpc-server"; 6 + import express from "npm:express"; 7 + import { validate as _validate } from "../../../../lexicons.ts"; 8 + import { is$typed as _is$typed } from "../../../../util.ts"; 9 + 10 + const is$typed = _is$typed, 11 + validate = _validate; 12 + const id = "social.grain.darkroom.getGalleryComposite"; 13 + 14 + export interface QueryParams { 15 + /** The AT-URI of the gallery to return a composite for. */ 16 + uri: string; 17 + } 18 + 19 + export type InputSchema = undefined; 20 + export type HandlerInput = undefined; 21 + 22 + export interface HandlerSuccess { 23 + encoding: "*/*"; 24 + body: Uint8Array | stream.Readable; 25 + headers?: { [key: string]: string }; 26 + } 27 + 28 + export interface HandlerError { 29 + status: number; 30 + message?: string; 31 + } 32 + 33 + export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough; 34 + export type HandlerReqCtx<HA extends HandlerAuth = never> = { 35 + auth: HA; 36 + params: QueryParams; 37 + input: HandlerInput; 38 + req: express.Request; 39 + res: express.Response; 40 + resetRouteRateLimits: () => Promise<void>; 41 + }; 42 + export type Handler<HA extends HandlerAuth = never> = ( 43 + ctx: HandlerReqCtx<HA>, 44 + ) => Promise<HandlerOutput> | HandlerOutput;
+1 -1
deno.json appview/deno.json
··· 30 30 "dev:tailwind": "deno run -A --node-modules-dir npm:@tailwindcss/cli -i ./src/input.css -o ./build/styles.css --watch", 31 31 "dev:fonts": "rm -rf ./build/fonts && cp -r ./static/fonts/. ./build/fonts", 32 32 "sync": "deno run -A --env=.env jsr:@bigmoves/bff-cli@0.3.0-beta.40 sync --collections=social.grain.gallery,social.grain.actor.profile,social.grain.photo,social.grain.favorite,social.grain.gallery.item,social.grain.graph.follow,social.grain.photo.exif,social.grain.comment --external-collections=app.bsky.actor.profile,app.bsky.graph.follow,sh.tangled.graph.follow,sh.tangled.actor.profile --collection-key-map=\"{\\\"social.grain.favorite\\\":[\\\"subject\\\"],\\\"social.grain.graph.follow\\\":[\\\"subject\\\"],\\\"social.grain.gallery.item\\\":[\\\"gallery\\\",\\\"item\\\"],\\\"social.grain.photo.exif\\\":[\\\"photo\\\"],\\\"social.grain.comment\\\":[\\\"subject\\\"]}\"", 33 - "codegen": "deno run -A jsr:@bigmoves/bff-cli@0.3.0-beta.42 lexgen" 33 + "codegen": "deno run -A jsr:@bigmoves/bff-cli@0.3.0-beta.57 lexgen --lexicon-dir=../lexicons" 34 34 }, 35 35 "compilerOptions": { 36 36 "jsx": "precompile",
deno.lock appview/deno.lock
fly.toml appview/fly.toml
globals.d.ts appview/globals.d.ts
litefs.yml appview/litefs.yml
+4 -1
services/darkroom/src/composite_handler.rs
··· 24 24 25 25 // Build preview URL with variant parameter support 26 26 let base_url = std::env::var("BASE_URL").unwrap_or_else(|_| "http://[::]:8080".to_string()); 27 - let variant = params.get("variant").map(|s| s.as_str()).unwrap_or("adaptive"); 27 + let variant = params 28 + .get("variant") 29 + .map(|s| s.as_str()) 30 + .unwrap_or("adaptive"); 28 31 29 32 let preview_url = format!( 30 33 "{}/gallery-preview?uri={}&title={}&handle={}&variant={}",
src/api/mod.ts appview/src/api/mod.ts
src/app.tsx appview/src/app.tsx
src/components/ActorAvatar.tsx appview/src/components/ActorAvatar.tsx
src/components/ActorInfo.tsx appview/src/components/ActorInfo.tsx
src/components/AltTextButton.tsx appview/src/components/AltTextButton.tsx
src/components/AvatarButton.tsx appview/src/components/AvatarButton.tsx
src/components/AvatarDialog.tsx appview/src/components/AvatarDialog.tsx
src/components/AvatarInput.tsx appview/src/components/AvatarInput.tsx
src/components/Breadcrumb.tsx appview/src/components/Breadcrumb.tsx
src/components/Button.tsx appview/src/components/Button.tsx
src/components/CameraBadges.tsx appview/src/components/CameraBadges.tsx
src/components/CreateAccountDialog.tsx appview/src/components/CreateAccountDialog.tsx
src/components/DefaultAvatar.tsx appview/src/components/DefaultAvatar.tsx
src/components/DefaultLabelerAvatar.tsx appview/src/components/DefaultLabelerAvatar.tsx
src/components/Dialog.tsx appview/src/components/Dialog.tsx
src/components/EditGalleryDialog.tsx appview/src/components/EditGalleryDialog.tsx
src/components/ExifInfoDialog.tsx appview/src/components/ExifInfoDialog.tsx
src/components/ExifOverlayDialog.tsx appview/src/components/ExifOverlayDialog.tsx
src/components/FavoriteButton.tsx appview/src/components/FavoriteButton.tsx
src/components/FollowButton.tsx appview/src/components/FollowButton.tsx
src/components/FollowsList.tsx appview/src/components/FollowsList.tsx
src/components/GalleryDetailsDialog.tsx appview/src/components/GalleryDetailsDialog.tsx
src/components/GalleryEditPhotosDialog.tsx appview/src/components/GalleryEditPhotosDialog.tsx
src/components/GalleryInfo.tsx appview/src/components/GalleryInfo.tsx
src/components/GalleryLayout.tsx appview/src/components/GalleryLayout.tsx
src/components/GalleryPage.tsx appview/src/components/GalleryPage.tsx
src/components/GalleryPreviewLink.tsx appview/src/components/GalleryPreviewLink.tsx
src/components/GallerySelectDialog.tsx appview/src/components/GallerySelectDialog.tsx
src/components/GallerySortDialog.tsx appview/src/components/GallerySortDialog.tsx
src/components/Header.tsx appview/src/components/Header.tsx
src/components/Input.tsx appview/src/components/Input.tsx
src/components/JustifiedSvg.tsx appview/src/components/JustifiedSvg.tsx
src/components/Label.tsx appview/src/components/Label.tsx
src/components/LabelDefinitionButton.tsx appview/src/components/LabelDefinitionButton.tsx
src/components/LabelDefinitionDialog.tsx appview/src/components/LabelDefinitionDialog.tsx
src/components/LabelerAvatar.tsx appview/src/components/LabelerAvatar.tsx
src/components/Layout.tsx appview/src/components/Layout.tsx
src/components/LibraryPhotoSelectDialog.tsx appview/src/components/LibraryPhotoSelectDialog.tsx
src/components/Login.tsx appview/src/components/Login.tsx
src/components/LoginPage.tsx appview/src/components/LoginPage.tsx
src/components/MasonrySvg.tsx appview/src/components/MasonrySvg.tsx
src/components/ModerationWrapper.tsx appview/src/components/ModerationWrapper.tsx
src/components/NotificationsPage.tsx appview/src/components/NotificationsPage.tsx
src/components/PhotoAltDialog.tsx appview/src/components/PhotoAltDialog.tsx
src/components/PhotoDialog.tsx appview/src/components/PhotoDialog.tsx
src/components/PhotoExifButton.tsx appview/src/components/PhotoExifButton.tsx
src/components/PhotoExifDialog.tsx appview/src/components/PhotoExifDialog.tsx
src/components/PhotoPreview.tsx appview/src/components/PhotoPreview.tsx
src/components/PhotoSelectButton.tsx appview/src/components/PhotoSelectButton.tsx
src/components/ProfileDialog.tsx appview/src/components/ProfileDialog.tsx
src/components/ProfilePage.tsx appview/src/components/ProfilePage.tsx
src/components/RemovePhotoDialog.tsx appview/src/components/RemovePhotoDialog.tsx
src/components/RenderFacetedText.tsx appview/src/components/RenderFacetedText.tsx
src/components/ShareGalleryDialog.tsx appview/src/components/ShareGalleryDialog.tsx
src/components/Textarea.tsx appview/src/components/Textarea.tsx
src/components/Timeline.tsx appview/src/components/Timeline.tsx
src/components/TimelineItem.tsx appview/src/components/TimelineItem.tsx
src/components/UploadPage.tsx appview/src/components/UploadPage.tsx
src/env.ts appview/src/env.ts
src/input.css appview/src/input.css
src/legal.tsx appview/src/legal.tsx
src/lib/actor.ts appview/src/lib/actor.ts
src/lib/errors.ts appview/src/lib/errors.ts
src/lib/favs.ts appview/src/lib/favs.ts
src/lib/gallery.ts appview/src/lib/gallery.ts
src/lib/graph.ts appview/src/lib/graph.ts
src/lib/moderation.ts appview/src/lib/moderation.ts
src/lib/notifications.ts appview/src/lib/notifications.ts
src/lib/photo.ts appview/src/lib/photo.ts
src/lib/rich_text.ts appview/src/lib/rich_text.ts
src/lib/timeline.ts appview/src/lib/timeline.ts
src/main.tsx appview/src/main.tsx
src/meta.ts appview/src/meta.ts
src/modules/comments.tsx appview/src/modules/comments.tsx
src/routes/actions.tsx appview/src/routes/actions.tsx
src/routes/community_guidelines.tsx appview/src/routes/community_guidelines.tsx
src/routes/dialogs.tsx appview/src/routes/dialogs.tsx
src/routes/explore.tsx appview/src/routes/explore.tsx
src/routes/followers.tsx appview/src/routes/followers.tsx
src/routes/follows.tsx appview/src/routes/follows.tsx
src/routes/gallery.tsx appview/src/routes/gallery.tsx
src/routes/hashtag.tsx appview/src/routes/hashtag.tsx
src/routes/legal.tsx appview/src/routes/legal.tsx
src/routes/notifications.tsx appview/src/routes/notifications.tsx
src/routes/onboard.tsx appview/src/routes/onboard.tsx
src/routes/profile.tsx appview/src/routes/profile.tsx
src/routes/record.ts appview/src/routes/record.ts
src/routes/robots.tsx appview/src/routes/robots.tsx
src/routes/support.tsx appview/src/routes/support.tsx
src/routes/timeline.tsx appview/src/routes/timeline.tsx
src/routes/upload.tsx appview/src/routes/upload.tsx
src/state.ts appview/src/state.ts
src/static/exif.ts appview/src/static/exif.ts
src/static/gallery_layout.ts appview/src/static/gallery_layout.ts
src/static/gallery_photos_dialog.ts appview/src/static/gallery_photos_dialog.ts
src/static/mod.ts appview/src/static/mod.ts
src/static/photo_dialog.ts appview/src/static/photo_dialog.ts
src/static/profile_dialog.ts appview/src/static/profile_dialog.ts
src/static/upload_page.ts appview/src/static/upload_page.ts
src/static/utils.ts appview/src/static/utils.ts
src/utils.ts appview/src/utils.ts
static/fonts/Jersey20-Regular.ttf appview/static/fonts/Jersey20-Regular.ttf
sync.sh appview/sync.sh