mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Upgrade grats
This commit is contained in:
parent
4dbc326b03
commit
c53ad16ba5
23 changed files with 1425 additions and 254 deletions
1
packages/skin-database/.prettierignore
Normal file
1
packages/skin-database/.prettierignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
api/graphql/schema.ts
|
||||
1
packages/skin-database/api/graphql/GqlCtx.ts
Normal file
1
packages/skin-database/api/graphql/GqlCtx.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export type GqlCtx = Express.Request;
|
||||
|
|
@ -4,6 +4,7 @@ import { knex } from "../../db";
|
|||
import ModernSkinResolver from "./resolvers/ModernSkinResolver";
|
||||
import { Root } from "aws-sdk/clients/organizations";
|
||||
import RootResolver from "./resolvers/RootResolver";
|
||||
import { GqlCtx } from "./GqlCtx";
|
||||
|
||||
/**
|
||||
* A collection of "modern" Winamp skins
|
||||
|
|
@ -31,7 +32,10 @@ export default class ModernSkinsConnection {
|
|||
/**
|
||||
* The list of skins
|
||||
* @gqlField */
|
||||
async nodes(_args: never, ctx): Promise<Array<ModernSkinResolver | null>> {
|
||||
async nodes(
|
||||
_args: unknown,
|
||||
ctx: GqlCtx
|
||||
): Promise<Array<ModernSkinResolver | null>> {
|
||||
const skins = await this._getQuery()
|
||||
.select()
|
||||
.limit(this._first)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import LRU from "lru-cache";
|
|||
import { Int } from "grats";
|
||||
import { ISkin } from "./resolvers/CommonSkinResolver";
|
||||
import RootResolver from "./resolvers/RootResolver";
|
||||
import { GqlCtx } from "./GqlCtx";
|
||||
|
||||
const options = {
|
||||
max: 100,
|
||||
|
|
@ -97,7 +98,7 @@ export default class SkinsConnection {
|
|||
* The list of skins
|
||||
* @gqlField
|
||||
*/
|
||||
async nodes(args: never, ctx): Promise<Array<ISkin | null>> {
|
||||
async nodes(args: unknown, ctx: GqlCtx): Promise<Array<ISkin | null>> {
|
||||
if (this._sort === "MUSEUM") {
|
||||
if (this._filter) {
|
||||
throw new Error(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import TweetModel from "../../data/TweetModel";
|
|||
import { knex } from "../../db";
|
||||
import TweetResolver from "./resolvers/TweetResolver";
|
||||
import RootResolver from "./resolvers/RootResolver";
|
||||
import { GqlCtx } from "./GqlCtx";
|
||||
|
||||
/** @gqlEnum */
|
||||
export type TweetsSortOption = "LIKES" | "RETWEETS";
|
||||
|
|
@ -45,7 +46,10 @@ export default class TweetsConnection {
|
|||
* The list of tweets
|
||||
* @gqlField
|
||||
*/
|
||||
async nodes(args: never, ctx): Promise<Array<TweetResolver | null>> {
|
||||
async nodes(
|
||||
args: unknown,
|
||||
ctx: GqlCtx
|
||||
): Promise<Array<TweetResolver | null>> {
|
||||
const tweets = await this._getQuery()
|
||||
.select()
|
||||
.limit(this._first)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
import { Router } from "express";
|
||||
import { graphqlHTTP } from "express-graphql";
|
||||
|
||||
import RootResolver from "./resolvers/RootResolver";
|
||||
import DEFAULT_QUERY from "./defaultQuery";
|
||||
import { buildSchema } from "graphql";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const schemaPath = path.join(__dirname, "./schema.graphql");
|
||||
const schema = buildSchema(fs.readFileSync(schemaPath, "utf8"));
|
||||
import { schema } from "./schema";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
|
@ -44,8 +38,7 @@ const extensions = ({
|
|||
router.use(
|
||||
"/",
|
||||
graphqlHTTP({
|
||||
schema: schema,
|
||||
rootValue: new RootResolver(),
|
||||
schema,
|
||||
graphiql: {
|
||||
defaultQuery: DEFAULT_QUERY,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import SkinModel from "../../../data/SkinModel";
|
|||
import { ISkin } from "./CommonSkinResolver";
|
||||
import SkinResolver from "./SkinResolver";
|
||||
import RootResolver from "./RootResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
/**
|
||||
* A file found within a Winamp Skin's .wsz archive
|
||||
|
|
@ -66,7 +67,7 @@ export default class ArchiveFileResolver {
|
|||
* The skin in which this file was found
|
||||
* @gqlField
|
||||
*/
|
||||
async skin(_: never, { ctx }): Promise<ISkin | null> {
|
||||
async skin(_: unknown, { ctx }: GqlCtx): Promise<ISkin | null> {
|
||||
const model = await SkinModel.fromMd5Assert(ctx, this._model.getMd5());
|
||||
return SkinResolver.fromModel(model);
|
||||
}
|
||||
|
|
@ -90,7 +91,7 @@ export default class ArchiveFileResolver {
|
|||
export async function fetch_archive_file_by_md5(
|
||||
_: RootResolver,
|
||||
{ md5 }: { md5: string },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<ArchiveFileResolver | null> {
|
||||
const archiveFile = await ArchiveFileModel.fromFileMd5(ctx, md5);
|
||||
if (archiveFile == null) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import IaItemModel from "../../../data/IaItemModel";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
import { ISkin } from "./CommonSkinResolver";
|
||||
import RootResolver from "./RootResolver";
|
||||
import SkinResolver from "./SkinResolver";
|
||||
|
|
@ -70,7 +71,7 @@ export default class InternetArchiveItemResolver {
|
|||
export async function fetch_internet_archive_item_by_identifier(
|
||||
_: RootResolver,
|
||||
{ identifier }: { identifier: string },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<InternetArchiveItemResolver | null> {
|
||||
const iaItem = await IaItemModel.fromIdentifier(ctx, identifier);
|
||||
if (iaItem == null) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import ArchiveFileResolver from "./ArchiveFileResolver";
|
|||
import TweetResolver from "./TweetResolver";
|
||||
import { XMLParser } from "fast-xml-parser";
|
||||
import RootResolver from "./RootResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
/**
|
||||
* A "modern" Winamp skin. These skins use the `.wal` file extension and are free-form.
|
||||
|
|
@ -179,7 +180,7 @@ export default class ModernSkinResolver
|
|||
export async function fetch_skin_by_md5(
|
||||
_: RootResolver,
|
||||
{ md5 }: { md5: string },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<ISkin | null> {
|
||||
const skin = await SkinModel.fromMd5(ctx, md5);
|
||||
if (skin == null) {
|
||||
|
|
|
|||
|
|
@ -1,85 +1,6 @@
|
|||
import * as Parallel from "async-parallel";
|
||||
import SkinModel from "../../../data/SkinModel";
|
||||
import * as S3 from "../../../s3";
|
||||
import * as Skins from "../../../data/skins";
|
||||
import { processUserUploads } from "../../processUserUploads";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
// We don't use a resolver here, just return the value directly.
|
||||
/**
|
||||
* A URL that the client can use to upload a skin to S3, and then notify the server
|
||||
* when they're done.
|
||||
* @gqlType
|
||||
*/
|
||||
type UploadUrl = {
|
||||
/** @gqlField */
|
||||
id: string;
|
||||
/** @gqlField */
|
||||
url: string;
|
||||
/** @gqlField */
|
||||
md5: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Input object used for a user to request an UploadUrl
|
||||
* @gqlInput
|
||||
*/
|
||||
type UploadUrlRequest = { filename: string; md5: string };
|
||||
|
||||
/**
|
||||
* Mutations for the upload flow
|
||||
*
|
||||
* 1. The user finds the md5 hash of their local files.
|
||||
* 2. (`get_upload_urls`) The user requests upload URLs for each of their files.
|
||||
* 3. The server returns upload URLs for each of their files which are not already in the collection.
|
||||
* 4. The user uploads each of their files to the URLs returned in step 3.
|
||||
* 5. (`report_skin_uploaded`) The user notifies the server that they're done uploading.
|
||||
* 6. (TODO) The user polls for the status of their uploads.
|
||||
*
|
||||
* @gqlType UploadMutations */
|
||||
class UploadMutationResolver {
|
||||
/**
|
||||
* Get a (possibly incompelte) list of UploadUrls for each of the files. If an
|
||||
* UploadUrl is not returned for a given hash, it means the file is already in
|
||||
* the collection.
|
||||
* @gqlField
|
||||
*/
|
||||
async get_upload_urls(
|
||||
{ files }: { files: UploadUrlRequest[] },
|
||||
{ ctx }
|
||||
): Promise<Array<UploadUrl | null>> {
|
||||
const missing: UploadUrl[] = [];
|
||||
await Parallel.each(
|
||||
files,
|
||||
async ({ md5, filename }) => {
|
||||
if (!(await SkinModel.exists(ctx, md5))) {
|
||||
const id = await Skins.recordUserUploadRequest(md5, filename);
|
||||
const url = S3.getSkinUploadUrl(md5, id);
|
||||
missing.push({ id, url, md5 });
|
||||
}
|
||||
},
|
||||
5
|
||||
);
|
||||
|
||||
return missing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the server that the user is done uploading.
|
||||
* @gqlField
|
||||
*/
|
||||
async report_skin_uploaded(
|
||||
{ id, md5 }: { id: string; md5: string },
|
||||
req
|
||||
): Promise<boolean> {
|
||||
// TODO: Validate md5 and id;
|
||||
await Skins.recordUserUploadComplete(md5, id);
|
||||
// Don't await, just kick off the task.
|
||||
processUserUploads(req.notify);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function requireAuthed(handler) {
|
||||
export function requireAuthed(handler) {
|
||||
return (args, req) => {
|
||||
if (!req.ctx.authed()) {
|
||||
throw new Error("You must be logged in to read this field.");
|
||||
|
|
@ -89,105 +10,22 @@ function requireAuthed(handler) {
|
|||
};
|
||||
}
|
||||
|
||||
/** @gqlType Mutation */
|
||||
export type MutationResolver = unknown;
|
||||
|
||||
/**
|
||||
*
|
||||
* @gqlType Mutation */
|
||||
export default class MutationResolver {
|
||||
/**
|
||||
* Mutations for the upload flow
|
||||
* @gqlField */
|
||||
async upload(): Promise<UploadMutationResolver> {
|
||||
return new UploadMutationResolver();
|
||||
}
|
||||
/**
|
||||
* Send a message to the admin of the site. Currently this appears in Discord.
|
||||
* @gqlField */
|
||||
async send_feedback(
|
||||
{ message, email, url }: { message: string; email?: string; url?: string },
|
||||
req
|
||||
): Promise<boolean> {
|
||||
req.notify({
|
||||
type: "GOT_FEEDBACK",
|
||||
url,
|
||||
message,
|
||||
email,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject skin for tweeting
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
reject_skin(args: { md5: string }, req): Promise<boolean> {
|
||||
return this._reject_skin(args, req);
|
||||
}
|
||||
|
||||
_reject_skin = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Rejecting skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5Assert(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.reject(req.ctx, md5);
|
||||
req.notify({ type: "REJECTED_SKIN", md5 });
|
||||
return true;
|
||||
* Send a message to the admin of the site. Currently this appears in Discord.
|
||||
* @gqlField */
|
||||
export async function send_feedback(
|
||||
_: MutationResolver,
|
||||
{ message, email, url }: { message: string; email?: string; url?: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
req.notify({
|
||||
type: "GOT_FEEDBACK",
|
||||
url,
|
||||
message,
|
||||
email,
|
||||
});
|
||||
|
||||
/**
|
||||
* Approve skin for tweeting
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
approve_skin(args: { md5: string }, req): Promise<boolean> {
|
||||
return this._approve_skin(args, req);
|
||||
}
|
||||
|
||||
_approve_skin = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Approving skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.approve(req.ctx, md5);
|
||||
req.notify({ type: "APPROVED_SKIN", md5 });
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* Mark a skin as NSFW
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
mark_skin_nsfw(args: { md5: string }, req): Promise<boolean> {
|
||||
return this._mark_skin_nsfw(args, req);
|
||||
}
|
||||
|
||||
_mark_skin_nsfw = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Approving skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.markAsNSFW(req.ctx, md5);
|
||||
req.notify({ type: "MARKED_SKIN_NSFW", md5 });
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* Request that an admin check if this skin is NSFW.
|
||||
* Unlike other review mutaiton endpoints, this one does not require being logged
|
||||
* in.
|
||||
* @gqlField */
|
||||
async request_nsfw_review_for_skin(
|
||||
{ md5 }: { md5: string },
|
||||
req
|
||||
): Promise<boolean> {
|
||||
req.log(`Reporting skin with hash "${md5}"`);
|
||||
// Blow up if there is no skin with this hash
|
||||
await SkinModel.fromMd5Assert(req.ctx, md5);
|
||||
req.notify({ type: "REVIEW_REQUESTED", md5 });
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ID } from "grats";
|
|||
import SkinModel from "../../../data/SkinModel";
|
||||
import SkinResolver from "../resolvers/SkinResolver";
|
||||
import RootResolver from "./RootResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
/**
|
||||
* A globally unique object. The `id` here is intended only for use within
|
||||
|
|
@ -29,7 +30,7 @@ export interface NodeResolver {
|
|||
export async function node(
|
||||
_: RootResolver,
|
||||
{ id }: { id: ID },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<NodeResolver | null> {
|
||||
const { graphqlType, id: localId } = fromId(id);
|
||||
// TODO Use typeResolver
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { Rating, ReviewRow } from "../../../types";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
import { ISkin } from "./CommonSkinResolver";
|
||||
import SkinResolver from "./SkinResolver";
|
||||
|
||||
/**
|
||||
* A review of a skin. Done either on the Museum's Tinder-style
|
||||
* reivew page, or via the Discord bot.
|
||||
* review page, or via the Discord bot.
|
||||
* @gqlType Review */
|
||||
export default class ReviewResolver {
|
||||
_model: ReviewRow;
|
||||
|
|
@ -16,7 +17,7 @@ export default class ReviewResolver {
|
|||
* The skin that was reviewed
|
||||
* @gqlField
|
||||
*/
|
||||
skin(args: never, { ctx }): Promise<ISkin | null> {
|
||||
skin(args: unknown, { ctx }: GqlCtx): Promise<ISkin | null> {
|
||||
return SkinResolver.fromMd5(ctx, this._model.skin_md5);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import MutationResolver from "./MutationResolver";
|
||||
import { ISkin } from "./CommonSkinResolver";
|
||||
|
||||
/** @gqlType Query */
|
||||
class RootResolver extends MutationResolver {}
|
||||
type RootResolver = unknown;
|
||||
|
||||
export default RootResolver;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import RootResolver from "./RootResolver";
|
|||
import { Int } from "grats";
|
||||
|
||||
import algoliasearch from "algoliasearch";
|
||||
import { requireAuthed, MutationResolver } from "./MutationResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
// These keys are already in the web client, so they are not secret at all.
|
||||
const client = algoliasearch("HQ9I5Z6IM5", "6466695ec3f624a5fccf46ec49680e51");
|
||||
|
|
@ -46,7 +48,7 @@ export async function search_skins(
|
|||
first = 10,
|
||||
offset = 0,
|
||||
}: { query: string; first?: Int; offset?: Int },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<Array<ISkin | null>> {
|
||||
if (first > 1000) {
|
||||
throw new Error("Can only query 1000 records via search.");
|
||||
|
|
@ -71,8 +73,8 @@ export async function search_skins(
|
|||
* @gqlField */
|
||||
export async function skin_to_review(
|
||||
_: RootResolver,
|
||||
_args: never,
|
||||
{ ctx }
|
||||
_args: unknown,
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<ISkin | null> {
|
||||
if (!ctx.authed()) {
|
||||
return null;
|
||||
|
|
@ -81,3 +83,92 @@ export async function skin_to_review(
|
|||
const model = await SkinModel.fromMd5Assert(ctx, md5);
|
||||
return SkinResolver.fromModel(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that an admin check if this skin is NSFW.
|
||||
* Unlike other review mutation endpoints, this one does not require being logged
|
||||
* in.
|
||||
* @gqlField */
|
||||
export async function request_nsfw_review_for_skin(
|
||||
_: MutationResolver,
|
||||
{ md5 }: { md5: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
req.log(`Reporting skin with hash "${md5}"`);
|
||||
// Blow up if there is no skin with this hash
|
||||
await SkinModel.fromMd5Assert(req.ctx, md5);
|
||||
req.notify({ type: "REVIEW_REQUESTED", md5 });
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a skin as NSFW
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
export function mark_skin_nsfw(
|
||||
_: MutationResolver,
|
||||
args: { md5: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
return _mark_skin_nsfw(args, req);
|
||||
}
|
||||
|
||||
const _mark_skin_nsfw = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Approving skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.markAsNSFW(req.ctx, md5);
|
||||
req.notify({ type: "MARKED_SKIN_NSFW", md5 });
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* Reject skin for tweeting
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
export function reject_skin(
|
||||
_: MutationResolver,
|
||||
args: { md5: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
return _reject_skin(args, req);
|
||||
}
|
||||
|
||||
const _reject_skin = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Rejecting skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5Assert(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.reject(req.ctx, md5);
|
||||
req.notify({ type: "REJECTED_SKIN", md5 });
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* Approve skin for tweeting
|
||||
*
|
||||
* **Note:** Requires being logged in
|
||||
* @gqlField */
|
||||
export function approve_skin(
|
||||
_: MutationResolver,
|
||||
args: { md5: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
return _approve_skin(args, req);
|
||||
}
|
||||
|
||||
const _approve_skin = requireAuthed(async ({ md5 }, req) => {
|
||||
req.log(`Approving skin with hash "${md5}"`);
|
||||
const skin = await SkinModel.fromMd5(req.ctx, md5);
|
||||
if (skin == null) {
|
||||
return false;
|
||||
}
|
||||
await Skins.approve(req.ctx, md5);
|
||||
req.notify({ type: "APPROVED_SKIN", md5 });
|
||||
return true;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import SkinResolver from "../resolvers/SkinResolver";
|
|||
import { knex } from "../../../db";
|
||||
import { ISkin } from "./CommonSkinResolver";
|
||||
import RootResolver from "./RootResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
/**
|
||||
* Information about an attempt to upload a skin to the Museum.
|
||||
|
|
@ -58,7 +59,7 @@ type SkinUploadStatus =
|
|||
export async function upload_statuses_by_md5(
|
||||
_: RootResolver,
|
||||
{ md5s }: { md5s: string[] },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<Array<SkinUpload | null>> {
|
||||
return _upload_statuses({ keyName: "skin_md5", keys: md5s }, ctx);
|
||||
}
|
||||
|
|
@ -69,7 +70,7 @@ export async function upload_statuses_by_md5(
|
|||
export async function upload_statuses(
|
||||
_: RootResolver,
|
||||
{ ids }: { ids: string[] },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<Array<SkinUpload | null>> {
|
||||
return _upload_statuses({ keyName: "id", keys: ids }, ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import TweetModel from "../../../data/TweetModel";
|
|||
import { ISkin } from "./CommonSkinResolver";
|
||||
import SkinResolver from "./SkinResolver";
|
||||
import RootResolver from "./RootResolver";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
/**
|
||||
* A tweet made by @winampskins mentioning a Winamp skin
|
||||
|
|
@ -57,7 +58,7 @@ export default class TweetResolver {
|
|||
export async function fetch_tweet_by_url(
|
||||
_: RootResolver,
|
||||
{ url }: { url: string },
|
||||
{ ctx }
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<TweetResolver | null> {
|
||||
const tweet = await TweetModel.fromAnything(ctx, url);
|
||||
if (tweet == null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
import * as Parallel from "async-parallel";
|
||||
import SkinModel from "../../../data/SkinModel";
|
||||
import * as S3 from "../../../s3";
|
||||
import * as Skins from "../../../data/skins";
|
||||
import { MutationResolver } from "./MutationResolver";
|
||||
import { processUserUploads } from "../../processUserUploads";
|
||||
import { GqlCtx } from "../GqlCtx";
|
||||
|
||||
// We don't use a resolver here, just return the value directly.
|
||||
/**
|
||||
* A URL that the client can use to upload a skin to S3, and then notify the server
|
||||
* when they're done.
|
||||
* @gqlType
|
||||
*/
|
||||
type UploadUrl = {
|
||||
/** @gqlField */
|
||||
id: string;
|
||||
/** @gqlField */
|
||||
url: string;
|
||||
/** @gqlField */
|
||||
md5: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Input object used for a user to request an UploadUrl
|
||||
* @gqlInput
|
||||
*/
|
||||
type UploadUrlRequest = { filename: string; md5: string };
|
||||
|
||||
/**
|
||||
* Mutations for the upload flow
|
||||
*
|
||||
* 1. The user finds the md5 hash of their local files.
|
||||
* 2. (`get_upload_urls`) The user requests upload URLs for each of their files.
|
||||
* 3. The server returns upload URLs for each of their files which are not already in the collection.
|
||||
* 4. The user uploads each of their files to the URLs returned in step 3.
|
||||
* 5. (`report_skin_uploaded`) The user notifies the server that they're done uploading.
|
||||
* 6. (TODO) The user polls for the status of their uploads.
|
||||
*
|
||||
* @gqlType UploadMutations */
|
||||
class UploadMutationResolver {
|
||||
/**
|
||||
* Get a (possibly incomplete) list of UploadUrls for each of the files. If an
|
||||
* UploadUrl is not returned for a given hash, it means the file is already in
|
||||
* the collection.
|
||||
* @gqlField
|
||||
*/
|
||||
async get_upload_urls(
|
||||
{ files }: { files: UploadUrlRequest[] },
|
||||
{ ctx }: GqlCtx
|
||||
): Promise<Array<UploadUrl | null>> {
|
||||
const missing: UploadUrl[] = [];
|
||||
await Parallel.each(
|
||||
files,
|
||||
async ({ md5, filename }) => {
|
||||
if (!(await SkinModel.exists(ctx, md5))) {
|
||||
const id = await Skins.recordUserUploadRequest(md5, filename);
|
||||
const url = S3.getSkinUploadUrl(md5, id);
|
||||
missing.push({ id, url, md5 });
|
||||
}
|
||||
},
|
||||
5
|
||||
);
|
||||
|
||||
return missing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the server that the user is done uploading.
|
||||
* @gqlField
|
||||
*/
|
||||
async report_skin_uploaded(
|
||||
{ id, md5 }: { id: string; md5: string },
|
||||
req: GqlCtx
|
||||
): Promise<boolean> {
|
||||
// TODO: Validate md5 and id;
|
||||
await Skins.recordUserUploadComplete(md5, id);
|
||||
// Don't await, just kick off the task.
|
||||
processUserUploads(req.notify);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutations for the upload flow
|
||||
* @gqlField */
|
||||
export async function upload(
|
||||
_: MutationResolver
|
||||
): Promise<UploadMutationResolver> {
|
||||
return new UploadMutationResolver();
|
||||
}
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
import { GqlCtx } from "../GqlCtx";
|
||||
import RootResolver from "./RootResolver";
|
||||
|
||||
/** @gqlType User */
|
||||
export default class UserResolver {
|
||||
/** @gqlField */
|
||||
username(_args: never, { ctx }): string {
|
||||
username(_args: unknown, { ctx }: GqlCtx): string | null {
|
||||
return ctx.username;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
schema {
|
||||
query: Query
|
||||
mutation: Mutation
|
||||
}
|
||||
|
||||
directive @exported(filename: String!, functionName: String!) on FIELD_DEFINITION
|
||||
|
||||
directive @methodName(name: String!) on FIELD_DEFINITION
|
||||
|
||||
# Schema generated by Grats (https://grats.capt.dev)
|
||||
# Do not manually edit. Regenerate by running `npx grats`.
|
||||
# @generated
|
||||
"""A file found within a Winamp Skin's .wsz archive"""
|
||||
type ArchiveFile {
|
||||
"""
|
||||
|
|
@ -14,22 +8,29 @@ type ArchiveFile {
|
|||
format (ISO 8601).
|
||||
"""
|
||||
date: String
|
||||
|
||||
"""The md5 hash of the file within the archive"""
|
||||
file_md5: String
|
||||
|
||||
"""Filename of the file within the archive"""
|
||||
filename: String
|
||||
|
||||
"""Is the file a directory?"""
|
||||
is_directory: Boolean
|
||||
|
||||
"""
|
||||
The uncompressed size of the file in bytes.
|
||||
|
||||
**Note:** Will be `null` for directories
|
||||
"""
|
||||
size: Int
|
||||
|
||||
"""The skin in which this file was found"""
|
||||
skin: Skin
|
||||
|
||||
"""The content of the file, if it's a text file"""
|
||||
text_content: String
|
||||
|
||||
"""
|
||||
A URL to download the file. **Note:** This is powered by a little
|
||||
serverless Cloudflare function which tries to exctact the file on the fly.
|
||||
|
|
@ -42,10 +43,13 @@ type ArchiveFile {
|
|||
type ClassicSkin implements Node & Skin {
|
||||
"""List of files contained within the skin's .wsz archive"""
|
||||
archive_files: [ArchiveFile]
|
||||
|
||||
"""String representation (rgb usually) of the skin's average color"""
|
||||
average_color: String
|
||||
|
||||
"""URL to download the skin"""
|
||||
download_url: String
|
||||
|
||||
"""
|
||||
Filename of skin when uploaded to the Museum. Note: In some cases a skin
|
||||
has been uploaded under multiple names. Here we just pick one.
|
||||
|
|
@ -57,38 +61,52 @@ type ClassicSkin implements Node & Skin {
|
|||
"""
|
||||
normalize_extension: Boolean = false
|
||||
): String
|
||||
|
||||
"""Does the skin include sprite sheets for the media library?"""
|
||||
has_media_library: Boolean
|
||||
|
||||
"""GraphQL ID of the skin"""
|
||||
id: ID!
|
||||
|
||||
"""The skin's "item" at archive.org"""
|
||||
internet_archive_item: InternetArchiveItem
|
||||
|
||||
"""
|
||||
The date on which this skin was last updated in the Algolia search index.
|
||||
Given in simplified extended ISO format (ISO 8601).
|
||||
"""
|
||||
last_algolia_index_update_date: String
|
||||
|
||||
"""MD5 hash of the skin's file"""
|
||||
md5: String
|
||||
|
||||
"""URL of the skin on the Winamp Skin Museum"""
|
||||
museum_url: String
|
||||
|
||||
"""Has the skin been flagged as "not safe for wrok"?"""
|
||||
nsfw: Boolean
|
||||
|
||||
"""Text of the readme file extracted from the skin"""
|
||||
readme_text: String
|
||||
|
||||
"""
|
||||
Times that the skin has been reviewed either on the Museum's Tinder-style
|
||||
reivew page, or via the Discord bot.
|
||||
"""
|
||||
reviews: [Review]
|
||||
|
||||
"""URL of a screenshot of the skin"""
|
||||
screenshot_url: String
|
||||
|
||||
"""The number of transparent pixels rendered by the skin."""
|
||||
transparent_pixels: Int
|
||||
|
||||
"""Has the skin been tweeted?"""
|
||||
tweeted: Boolean
|
||||
|
||||
"""List of @winampskins tweets that mentioned the skin."""
|
||||
tweets: [Tweet]
|
||||
|
||||
"""URL of webamp.org with the skin loaded"""
|
||||
webamp_url: String
|
||||
}
|
||||
|
|
@ -102,6 +120,7 @@ type DatabaseStatistics {
|
|||
**Note:** Skins can be both approved and rejected by different users.
|
||||
"""
|
||||
approved_skins_count: Int
|
||||
|
||||
"""
|
||||
The number of skins that have been marked as NSFW.
|
||||
|
||||
|
|
@ -109,6 +128,7 @@ type DatabaseStatistics {
|
|||
**Note:** Generally skins that have been marked NSFW are also marked as rejected.
|
||||
"""
|
||||
nsfw_skins_count: Int
|
||||
|
||||
"""
|
||||
The number of skins that have been rejected for tweeting.
|
||||
|
||||
|
|
@ -116,26 +136,33 @@ type DatabaseStatistics {
|
|||
**Note:** Generally skins that have been marked NSFW are also marked as rejected.
|
||||
"""
|
||||
rejected_skins_count: Int
|
||||
|
||||
"""
|
||||
The number of skins that have been approved for tweeting, but not yet tweeted.
|
||||
"""
|
||||
tweetable_skins_count: Int
|
||||
|
||||
"""
|
||||
The number of skins in the Museum that have been tweeted by @winampskins
|
||||
"""
|
||||
tweeted_skins_count: Int
|
||||
|
||||
"""The total number of classic skins in the Museum's database"""
|
||||
unique_classic_skins_count: Int
|
||||
|
||||
"""The number of skins that have never been reviewed."""
|
||||
unreviewed_skins_count: Int
|
||||
|
||||
"""Skins uploads that have errored during processing."""
|
||||
uploads_in_error_state_count: Int
|
||||
|
||||
"""
|
||||
Skins uplaods awaiting processing. This can happen when there are a large
|
||||
number of skin uplaods at the same time, or when the skin uploading processing
|
||||
pipeline gets stuck.
|
||||
"""
|
||||
uploads_pending_processing_count: Int
|
||||
|
||||
"""
|
||||
Number of skins that have been uploaded to the Museum via the web interface.
|
||||
"""
|
||||
|
|
@ -145,20 +172,25 @@ type DatabaseStatistics {
|
|||
type InternetArchiveItem {
|
||||
"""The Internet Archive's unique identifier for this item"""
|
||||
identifier: String
|
||||
|
||||
"""
|
||||
The date and time that we last scraped this item's metadata.
|
||||
**Note:** This field is temporary and will be removed in the future.
|
||||
The date format is just what we get from the database, and it's ambiguous.
|
||||
"""
|
||||
last_metadata_scrape_date_UNSTABLE: String
|
||||
|
||||
"""URL to get the Internet Archive's metadata for this item in JSON form."""
|
||||
metadata_url: String
|
||||
|
||||
"""
|
||||
Our cached version of the metadata avaliable at \`metadata_url\` (above)
|
||||
"""
|
||||
raw_metadata_json: String
|
||||
|
||||
"""The skin that this item contains"""
|
||||
skin: Skin
|
||||
|
||||
"""The URL where this item can be viewed on the Internet Archive"""
|
||||
url: String
|
||||
}
|
||||
|
|
@ -173,8 +205,10 @@ type ModernSkin implements Node & Skin {
|
|||
"""List of files contained within the skin's .wsz archive"""
|
||||
archive_files: [ArchiveFile]
|
||||
average_color: String @deprecated(reason: "Needed for migration")
|
||||
|
||||
"""URL to download the skin"""
|
||||
download_url: String
|
||||
|
||||
"""
|
||||
Filename of skin when uploaded to the Museum. Note: In some cases a skin
|
||||
has been uploaded under multiple names. Here we just pick one.
|
||||
|
|
@ -186,23 +220,29 @@ type ModernSkin implements Node & Skin {
|
|||
"""
|
||||
normalize_extension: Boolean = false
|
||||
): String
|
||||
|
||||
"""GraphQL ID of the skin"""
|
||||
id: ID!
|
||||
|
||||
"""The skin's "item" at archive.org"""
|
||||
internet_archive_item: InternetArchiveItem
|
||||
|
||||
"""MD5 hash of the skin's file"""
|
||||
md5: String
|
||||
museum_url: String @deprecated(reason: "Needed for migration")
|
||||
nsfw: Boolean @deprecated(reason: "Needed for migration")
|
||||
readme_text: String @deprecated(reason: "Needed for migration")
|
||||
|
||||
"""
|
||||
Times that the skin has been reviewed either on the Museum's Tinder-style
|
||||
reivew page, or via the Discord bot.
|
||||
"""
|
||||
reviews: [Review]
|
||||
screenshot_url: String
|
||||
|
||||
"""Has the skin been tweeted?"""
|
||||
tweeted: Boolean
|
||||
|
||||
"""List of @winampskins tweets that mentioned the skin."""
|
||||
tweets: [Tweet]
|
||||
webamp_url: String @deprecated(reason: "Needed for migration")
|
||||
|
|
@ -212,6 +252,7 @@ type ModernSkin implements Node & Skin {
|
|||
type ModernSkinsConnection {
|
||||
"""The total number of skins matching the filter"""
|
||||
count: Int
|
||||
|
||||
"""The list of skins"""
|
||||
nodes: [ModernSkin]
|
||||
}
|
||||
|
|
@ -223,28 +264,33 @@ type Mutation {
|
|||
**Note:** Requires being logged in
|
||||
"""
|
||||
approve_skin(md5: String!): Boolean
|
||||
|
||||
"""
|
||||
Mark a skin as NSFW
|
||||
|
||||
**Note:** Requires being logged in
|
||||
"""
|
||||
mark_skin_nsfw(md5: String!): Boolean
|
||||
|
||||
"""
|
||||
Reject skin for tweeting
|
||||
|
||||
**Note:** Requires being logged in
|
||||
"""
|
||||
reject_skin(md5: String!): Boolean
|
||||
|
||||
"""
|
||||
Request that an admin check if this skin is NSFW.
|
||||
Unlike other review mutaiton endpoints, this one does not require being logged
|
||||
Unlike other review mutation endpoints, this one does not require being logged
|
||||
in.
|
||||
"""
|
||||
request_nsfw_review_for_skin(md5: String!): Boolean
|
||||
|
||||
"""
|
||||
Send a message to the admin of the site. Currently this appears in Discord.
|
||||
"""
|
||||
send_feedback(email: String, message: String!, url: String): Boolean
|
||||
|
||||
"""Mutations for the upload flow"""
|
||||
upload: UploadMutations
|
||||
}
|
||||
|
|
@ -264,49 +310,62 @@ type Query {
|
|||
|
||||
Get information about a file found within a skin's wsz/wal/zip archive.
|
||||
"""
|
||||
fetch_archive_file_by_md5(md5: String!): ArchiveFile @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/ArchiveFileResolver.js", functionName: "fetch_archive_file_by_md5")
|
||||
fetch_archive_file_by_md5(md5: String!): ArchiveFile
|
||||
|
||||
"""
|
||||
Get an archive.org item by its identifier. You can find this in the URL:
|
||||
|
||||
https://archive.org/details/<identifier>/
|
||||
"""
|
||||
fetch_internet_archive_item_by_identifier(identifier: String!): InternetArchiveItem @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/InternetArchiveItemResolver.js", functionName: "fetch_internet_archive_item_by_identifier")
|
||||
fetch_internet_archive_item_by_identifier(identifier: String!): InternetArchiveItem
|
||||
|
||||
"""Get a skin by its MD5 hash"""
|
||||
fetch_skin_by_md5(md5: String!): Skin @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/ModernSkinResolver.js", functionName: "fetch_skin_by_md5")
|
||||
fetch_skin_by_md5(md5: String!): Skin
|
||||
|
||||
"""Get a tweet by its URL"""
|
||||
fetch_tweet_by_url(url: String!): Tweet @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/TweetResolver.js", functionName: "fetch_tweet_by_url")
|
||||
fetch_tweet_by_url(url: String!): Tweet
|
||||
|
||||
"""The currently authenticated user, if any."""
|
||||
me: User @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/UserResolver.js", functionName: "me")
|
||||
me: User
|
||||
|
||||
"""All modern skins in the database"""
|
||||
modern_skins(first: Int = 10, offset: Int = 0): ModernSkinsConnection @exported(filename: "../../../../packages/skin-database/dist/api/graphql/ModernSkinsConnection.js", functionName: "modern_skins")
|
||||
modern_skins(first: Int = 10, offset: Int = 0): ModernSkinsConnection
|
||||
|
||||
"""
|
||||
Get a globally unique object by its ID.
|
||||
|
||||
https://graphql.org/learn/global-object-identification/
|
||||
"""
|
||||
node(id: ID!): Node @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/NodeResolver.js", functionName: "node")
|
||||
node(id: ID!): Node
|
||||
|
||||
"""
|
||||
Search the database using the Algolia search index used by the Museum.
|
||||
|
||||
Useful for locating a particular skin.
|
||||
"""
|
||||
search_skins(first: Int = 10, offset: Int = 0, query: String!): [Skin] @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/SkinResolver.js", functionName: "search_skins")
|
||||
search_skins(first: Int = 10, offset: Int = 0, query: String!): [Skin]
|
||||
|
||||
"""A random skin that needs to be reviewed"""
|
||||
skin_to_review: Skin @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/SkinResolver.js", functionName: "skin_to_review")
|
||||
skin_to_review: Skin
|
||||
|
||||
"""
|
||||
All classic skins in the database
|
||||
|
||||
**Note:** We don't currently support combining sorting and filtering.
|
||||
"""
|
||||
skins(filter: SkinsFilterOption, first: Int = 10, offset: Int = 0, sort: SkinsSortOption): SkinsConnection @exported(filename: "../../../../packages/skin-database/dist/api/graphql/SkinsConnection.js", functionName: "skins")
|
||||
skins(filter: SkinsFilterOption, first: Int = 10, offset: Int = 0, sort: SkinsSortOption): SkinsConnection
|
||||
|
||||
"""A namespace for statistics about the database"""
|
||||
statistics: DatabaseStatistics @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/DatabaseStatisticsResolver.js", functionName: "statistics")
|
||||
statistics: DatabaseStatistics
|
||||
|
||||
"""Tweets tweeted by @winampskins"""
|
||||
tweets(first: Int = 10, offset: Int = 0, sort: TweetsSortOption): TweetsConnection @exported(filename: "../../../../packages/skin-database/dist/api/graphql/TweetsConnection.js", functionName: "tweets")
|
||||
tweets(first: Int = 10, offset: Int = 0, sort: TweetsSortOption): TweetsConnection
|
||||
|
||||
"""Get the status of a batch of uploads by ids"""
|
||||
upload_statuses(ids: [String!]!): [SkinUpload] @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/SkinUploadResolver.js", functionName: "upload_statuses")
|
||||
upload_statuses(ids: [String!]!): [SkinUpload]
|
||||
|
||||
"""Get the status of a batch of uploads by md5s"""
|
||||
upload_statuses_by_md5(md5s: [String!]!): [SkinUpload] @deprecated(reason: "Prefer `upload_statuses` instead, were we operate on ids.") @exported(filename: "../../../../packages/skin-database/dist/api/graphql/resolvers/SkinUploadResolver.js", functionName: "upload_statuses_by_md5")
|
||||
upload_statuses_by_md5(md5s: [String!]!): [SkinUpload] @deprecated(reason: "Prefer `upload_statuses` instead, were we operate on ids.")
|
||||
}
|
||||
|
||||
"""The judgement made about a skin by a moderator"""
|
||||
|
|
@ -318,16 +377,18 @@ enum Rating {
|
|||
|
||||
"""
|
||||
A review of a skin. Done either on the Museum's Tinder-style
|
||||
reivew page, or via the Discord bot.
|
||||
review page, or via the Discord bot.
|
||||
"""
|
||||
type Review {
|
||||
"""The rating that the user gave the skin"""
|
||||
rating: Rating
|
||||
|
||||
"""
|
||||
The user who made the review (if known). **Note:** In the early days we didn't
|
||||
track this, so many will be null.
|
||||
"""
|
||||
reviewer: String
|
||||
|
||||
"""The skin that was reviewed"""
|
||||
skin: Skin
|
||||
}
|
||||
|
|
@ -341,8 +402,10 @@ interface Skin {
|
|||
"""List of files contained within the skin's .wsz archive"""
|
||||
archive_files: [ArchiveFile]
|
||||
average_color: String @deprecated(reason: "Needed for migration")
|
||||
|
||||
"""URL to download the skin"""
|
||||
download_url: String
|
||||
|
||||
"""
|
||||
Filename of skin when uploaded to the Museum. Note: In some cases a skin
|
||||
has been uploaded under multiple names. Here we just pick one.
|
||||
|
|
@ -354,23 +417,29 @@ interface Skin {
|
|||
"""
|
||||
normalize_extension: Boolean = false
|
||||
): String
|
||||
|
||||
"""GraphQL ID of the skin"""
|
||||
id: ID!
|
||||
|
||||
"""The skin's "item" at archive.org"""
|
||||
internet_archive_item: InternetArchiveItem
|
||||
|
||||
"""MD5 hash of the skin's file"""
|
||||
md5: String
|
||||
museum_url: String @deprecated(reason: "Needed for migration")
|
||||
nsfw: Boolean @deprecated(reason: "Needed for migration")
|
||||
readme_text: String @deprecated(reason: "Needed for migration")
|
||||
|
||||
"""
|
||||
Times that the skin has been reviewed either on the Museum's Tinder-style
|
||||
reivew page, or via the Discord bot.
|
||||
"""
|
||||
reviews: [Review]
|
||||
screenshot_url: String
|
||||
|
||||
"""Has the skin been tweeted?"""
|
||||
tweeted: Boolean
|
||||
|
||||
"""List of @winampskins tweets that mentioned the skin."""
|
||||
tweets: [Tweet]
|
||||
webamp_url: String @deprecated(reason: "Needed for migration")
|
||||
|
|
@ -379,12 +448,14 @@ interface Skin {
|
|||
"""Information about an attempt to upload a skin to the Museum."""
|
||||
type SkinUpload {
|
||||
id: String
|
||||
|
||||
"""
|
||||
Skin that was uploaded. **Note:** This is null if the skin has not yet been
|
||||
fully processed. (status == ARCHIVED)
|
||||
"""
|
||||
skin: Skin
|
||||
status: SkinUploadStatus
|
||||
|
||||
"""Md5 hash given when requesting the upload URL."""
|
||||
upload_md5: String
|
||||
}
|
||||
|
|
@ -407,6 +478,7 @@ enum SkinUploadStatus {
|
|||
type SkinsConnection {
|
||||
"""The total number of skins matching the filter"""
|
||||
count: Int
|
||||
|
||||
"""The list of skins"""
|
||||
nodes: [Skin]
|
||||
}
|
||||
|
|
@ -428,12 +500,15 @@ type Tweet {
|
|||
Number of likes the tweet has received. Updated nightly. (Note: Recent likes on older tweets may not be reflected here)
|
||||
"""
|
||||
likes: Int
|
||||
|
||||
"""
|
||||
Number of retweets the tweet has received. Updated nightly. (Note: Recent retweets on older tweets may not be reflected here)
|
||||
"""
|
||||
retweets: Int
|
||||
|
||||
"""The skin featured in this Tweet"""
|
||||
skin: Skin
|
||||
|
||||
"""
|
||||
URL of the tweet. **Note:** Early on in the bot's life we just recorded
|
||||
_which_ skins were tweeted, not any info about the actual tweet. This means we
|
||||
|
|
@ -446,6 +521,7 @@ type Tweet {
|
|||
type TweetsConnection {
|
||||
"""The total number of tweets"""
|
||||
count: Int
|
||||
|
||||
"""The list of tweets"""
|
||||
nodes: [Tweet]
|
||||
}
|
||||
|
|
@ -467,11 +543,12 @@ Mutations for the upload flow
|
|||
"""
|
||||
type UploadMutations {
|
||||
"""
|
||||
Get a (possibly incompelte) list of UploadUrls for each of the files. If an
|
||||
Get a (possibly incomplete) list of UploadUrls for each of the files. If an
|
||||
UploadUrl is not returned for a given hash, it means the file is already in
|
||||
the collection.
|
||||
"""
|
||||
get_upload_urls(files: [UploadUrlRequest!]!): [UploadUrl]
|
||||
|
||||
"""Notify the server that the user is done uploading."""
|
||||
report_skin_uploaded(id: String!, md5: String!): Boolean
|
||||
}
|
||||
|
|
|
|||
1071
packages/skin-database/api/graphql/schema.ts
Normal file
1071
packages/skin-database/api/graphql/schema.ts
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -28,8 +28,7 @@
|
|||
"express-graphql": "^0.12.0",
|
||||
"express-sitemap-xml": "^2.0.0",
|
||||
"fast-xml-parser": "^4.2.2",
|
||||
"graphql": "14.7.0",
|
||||
"grats": "0.0.0-main-ded5e481",
|
||||
"graphql": "16.6.0",
|
||||
"imagemin": "^7.0.0",
|
||||
"imagemin-optipng": "^7.0.0",
|
||||
"knex": "^0.21.1",
|
||||
|
|
@ -65,6 +64,7 @@
|
|||
"@types/supertest": "^2.0.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
||||
"@typescript-eslint/parser": "^5.15.0",
|
||||
"grats": "0.0.0-main-bfb182a3",
|
||||
"supertest": "^6.0.1",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"grats": {
|
||||
"nullableByDefault": true
|
||||
"nullableByDefault": true,
|
||||
"EXPERIMENTAL_codegenPath": "./api/graphql/schema.ts"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
|
|
|
|||
23
yarn.lock
23
yarn.lock
|
|
@ -14778,22 +14778,20 @@ graphql-ws@^5.4.1:
|
|||
resolved "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.11.1.tgz"
|
||||
integrity sha512-AlOO/Gt0fXuSHXe/Weo6o3rIQVnH5MW7ophzeYzL+vYNlkf0NbWRJ6IIFgtSLcv9JpTlQdxSpB3t0SnM47/BHA==
|
||||
|
||||
graphql@14.7.0:
|
||||
version "14.7.0"
|
||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.7.0.tgz#7fa79a80a69be4a31c27dda824dc04dac2035a72"
|
||||
integrity sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA==
|
||||
dependencies:
|
||||
iterall "^1.2.2"
|
||||
graphql@16.6.0:
|
||||
version "16.6.0"
|
||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb"
|
||||
integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==
|
||||
|
||||
graphql@^16.6.0:
|
||||
version "16.8.1"
|
||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07"
|
||||
integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==
|
||||
|
||||
grats@0.0.0-main-ded5e481:
|
||||
version "0.0.0-main-ded5e481"
|
||||
resolved "https://registry.yarnpkg.com/grats/-/grats-0.0.0-main-ded5e481.tgz#19f7545aef96c4b5ddb7567532de9e1e96eca018"
|
||||
integrity sha512-WrL/irmHE9fETYdlC0kqAunlZNSn9ufebBZQYS+ORiI3/o6B2VeZ+KF64GFEjuxsoW3L29z1IZNCs+2Td2ro4Q==
|
||||
grats@0.0.0-main-bfb182a3:
|
||||
version "0.0.0-main-bfb182a3"
|
||||
resolved "https://registry.yarnpkg.com/grats/-/grats-0.0.0-main-bfb182a3.tgz#c566889fce58016d24b976c3274d0dda143366c6"
|
||||
integrity sha512-cFsUXkmqo5TsbV51danyyH3pFLWduTMSg6RNwskEOofgV/+GiKFdbmaLWsgI2B5/RcBkzPjdDGRN5B8u99pR7g==
|
||||
dependencies:
|
||||
"@graphql-tools/utils" "^9.2.1"
|
||||
commander "^10.0.0"
|
||||
|
|
@ -16513,11 +16511,6 @@ isurl@^1.0.0-alpha5:
|
|||
has-to-string-tag-x "^1.2.0"
|
||||
is-object "^1.0.1"
|
||||
|
||||
iterall@^1.2.2:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea"
|
||||
integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==
|
||||
|
||||
jake@^10.8.5:
|
||||
version "10.8.5"
|
||||
resolved "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue