diff --git a/lib/routes/digg/community.tsx b/lib/routes/digg/community.tsx index 182f5f4ac..8f05e8ab2 100644 --- a/lib/routes/digg/community.tsx +++ b/lib/routes/digg/community.tsx @@ -135,91 +135,93 @@ async function handler(ctx) { } = await ofetch(graphqlUrl, { method: 'POST', body: { - query: /* GraphQL */ `query CommunityQuery($id: ID, $slug: String) { - community(where: { _id_EQ: $id, slug_EQ: $slug }) { - ...CommunityFragment - topContributors { - account { - _id - avatarUrl - avatarImage { - ...ImageFragment - } - username - } - score - } - topGemFinders { - account { - _id - avatarUrl - avatarImage { - ...ImageFragment - } - username - } - score - } - } -} -fragment AuthorFragment on Account { - _id - username - avatarUrl - avatarImage { - ...ImageFragment - } - badges { - name - iconUrl - } - blockStatus - roles { - name - iconUrl - } -} -fragment CommunityFragment on Community { - _id - name - slug - description - iconUrl - guidelinesPM - descriptionPM - iconImage { - ...ImageFragment - } - bannerUrl - bannerDesktopImage { - ...ImageFragment - } - bannerMobileImage { - ...ImageFragment - } - founder { - ...AuthorFragment - bio - } - manager { - ...AuthorFragment - } - memberCount - postCount - isJoinedByAccount - isPinnedByAccount - isJoinedByDefault - createdDate - editedDate - deletedDate -} -fragment ImageFragment on Image { - alt - height - width - url - blurhash -}`, + query: /* GraphQL */ ` + query CommunityQuery($id: ID, $slug: String) { + community(where: { _id_EQ: $id, slug_EQ: $slug }) { + ...CommunityFragment + topContributors { + account { + _id + avatarUrl + avatarImage { + ...ImageFragment + } + username + } + score + } + topGemFinders { + account { + _id + avatarUrl + avatarImage { + ...ImageFragment + } + username + } + score + } + } + } + fragment AuthorFragment on Account { + _id + username + avatarUrl + avatarImage { + ...ImageFragment + } + badges { + name + iconUrl + } + blockStatus + roles { + name + iconUrl + } + } + fragment CommunityFragment on Community { + _id + name + slug + description + iconUrl + guidelinesPM + descriptionPM + iconImage { + ...ImageFragment + } + bannerUrl + bannerDesktopImage { + ...ImageFragment + } + bannerMobileImage { + ...ImageFragment + } + founder { + ...AuthorFragment + bio + } + manager { + ...AuthorFragment + } + memberCount + postCount + isJoinedByAccount + isPinnedByAccount + isJoinedByDefault + createdDate + editedDate + deletedDate + } + fragment ImageFragment on Image { + alt + height + width + url + blurhash + } + `, variables: { slug: community }, }, }); @@ -232,148 +234,145 @@ fragment ImageFragment on Image { } = await ofetch(graphqlUrl, { method: 'POST', body: { - query: /* GraphQL */ `query PostsQuery( - $first: Int - $after: String - $where: PostWhere - $sort: PostSort -) { - posts(first: $first, after: $after, where: $where, sort: $sort) { - edges { - node { - ...PostsNodeFragment - } - } - pageInfo { - ...PageInfoFragment - } - } -} -fragment AuthorFragment on Account { - _id - username - avatarUrl - avatarImage { - ...ImageFragment - } - badges { - name - iconUrl - } - blockStatus - roles { - name - iconUrl - } -} -fragment CommunityFragment on Community { - _id - name - slug - description - iconUrl - guidelinesPM - descriptionPM - iconImage { - ...ImageFragment - } - bannerUrl - bannerDesktopImage { - ...ImageFragment - } - bannerMobileImage { - ...ImageFragment - } - founder { - ...AuthorFragment - bio - } - manager { - ...AuthorFragment - } - memberCount - postCount - isJoinedByAccount - isPinnedByAccount - isJoinedByDefault - createdDate - editedDate - deletedDate -} -fragment ImageFragment on Image { - alt - height - width - url - blurhash -} -fragment ModerationReasonFragment on ModerationRemovalReason { - id - key - description - message - type - createdDate - editedDate - deletedDate -} -fragment PageInfoFragment on PageInfo { - endCursor - hasNextPage - hasPreviousPage - startCursor -} -fragment PostsNodeFragment on Post { - _id - title - isSavedByAccount - moderationStatus - isDuggByAccount - voteDirectionByAccount - upvoteCount - downvoteCount - score - reportByAccount - slug - type - externalContent { - url - headline - subHeadline - imageUrl - iconUrl - } - commentCount - shareCount - textPreview - contextCards { - tldr { - text - } - } - community { - ...CommunityFragment - } - attachments { - __typename - ... on Image { - ...ImageFragment - } - } - author { - ...AuthorFragment - } - createdDate - editedDate - deletedDate - nsfw - text - pm - moderatedDate - moderationReason { - ...ModerationReasonFragment - } -}`, + query: /* GraphQL */ ` + query PostsQuery($first: Int, $after: String, $where: PostWhere, $sort: PostSort) { + posts(first: $first, after: $after, where: $where, sort: $sort) { + edges { + node { + ...PostsNodeFragment + } + } + pageInfo { + ...PageInfoFragment + } + } + } + fragment AuthorFragment on Account { + _id + username + avatarUrl + avatarImage { + ...ImageFragment + } + badges { + name + iconUrl + } + blockStatus + roles { + name + iconUrl + } + } + fragment CommunityFragment on Community { + _id + name + slug + description + iconUrl + guidelinesPM + descriptionPM + iconImage { + ...ImageFragment + } + bannerUrl + bannerDesktopImage { + ...ImageFragment + } + bannerMobileImage { + ...ImageFragment + } + founder { + ...AuthorFragment + bio + } + manager { + ...AuthorFragment + } + memberCount + postCount + isJoinedByAccount + isPinnedByAccount + isJoinedByDefault + createdDate + editedDate + deletedDate + } + fragment ImageFragment on Image { + alt + height + width + url + blurhash + } + fragment ModerationReasonFragment on ModerationRemovalReason { + id + key + description + message + type + createdDate + editedDate + deletedDate + } + fragment PageInfoFragment on PageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + fragment PostsNodeFragment on Post { + _id + title + isSavedByAccount + moderationStatus + isDuggByAccount + voteDirectionByAccount + upvoteCount + downvoteCount + score + reportByAccount + slug + type + externalContent { + url + headline + subHeadline + imageUrl + iconUrl + } + commentCount + shareCount + textPreview + contextCards { + tldr { + text + } + } + community { + ...CommunityFragment + } + attachments { + __typename + ... on Image { + ...ImageFragment + } + } + author { + ...AuthorFragment + } + createdDate + editedDate + deletedDate + nsfw + text + pm + moderatedDate + moderationReason { + ...ModerationReasonFragment + } + } + `, variables: { first: limit, where: { community: { slug_EQ: community } }, sort: 'RECENT' }, }, }); diff --git a/lib/routes/link3/events.ts b/lib/routes/link3/events.ts index 7ca0660ec..271f0ae7a 100644 --- a/lib/routes/link3/events.ts +++ b/lib/routes/link3/events.ts @@ -58,7 +58,6 @@ async function handler() { } } } - `, }, }); diff --git a/lib/routes/link3/profile.ts b/lib/routes/link3/profile.ts index 097c72ce2..447dd6364 100644 --- a/lib/routes/link3/profile.ts +++ b/lib/routes/link3/profile.ts @@ -85,7 +85,6 @@ async function handler(ctx) { } } } - `, }, }); diff --git a/lib/routes/mirrormedia/category.ts b/lib/routes/mirrormedia/category.ts index 346e37e05..bed9ee060 100644 --- a/lib/routes/mirrormedia/category.ts +++ b/lib/routes/mirrormedia/category.ts @@ -39,48 +39,49 @@ async function handler(ctx) { }, }, query: /* GraphQL */ ` -fragment section on Section { - id - name - slug - state - __typename -} + fragment section on Section { + id + name + slug + state + __typename + } -fragment category on Category { - id - name - slug - state - __typename -} + fragment category on Category { + id + name + slug + state + __typename + } -fragment listingPost on Post { - id - slug - title - brief - publishedDate - state - sections(where: {state: {equals: "active"}}) { - ...section - __typename - } - categories(where: {state: {equals: "active"}}) { - ...category - __typename - } - isFeatured - __typename -} + fragment listingPost on Post { + id + slug + title + brief + publishedDate + state + sections(where: { state: { equals: "active" } }) { + ...section + __typename + } + categories(where: { state: { equals: "active" } }) { + ...category + __typename + } + isFeatured + __typename + } -query ($take: Int, $skip: Int, $orderBy: [PostOrderByInput!]!, $filter: PostWhereInput!) { - postsCount(where: $filter) - posts(take: $take, skip: $skip, orderBy: $orderBy, where: $filter) { - ...listingPost - __typename - } -}`, + query ($take: Int, $skip: Int, $orderBy: [PostOrderByInput!]!, $filter: PostWhereInput!) { + postsCount(where: $filter) + posts(take: $take, skip: $skip, orderBy: $orderBy, where: $filter) { + ...listingPost + __typename + } + } + `, }, }); diff --git a/lib/routes/mymusicsheet/usersheets.tsx b/lib/routes/mymusicsheet/usersheets.tsx index 046004d6e..c631a288a 100644 --- a/lib/routes/mymusicsheet/usersheets.tsx +++ b/lib/routes/mymusicsheet/usersheets.tsx @@ -57,50 +57,51 @@ async function handler(ctx) { body: { operationName: 'ArtistDetailLoadUser', query: /* GraphQL */ ` - query ArtistDetailLoadUser($artistUrl: String!) { - user(artistUrl: $artistUrl) { - coverUrl - coverImageMeta { - isDark - isLight - startRgba: rgba(opacity: 1) - endRgba: rgba(opacity: 0.24) - } - createdAt - instruments - userId - name - profileUrl - iamUuid - artistUrl - profileImageMeta { - startRgba: rgba(opacity: 1) - endRgba: rgba(opacity: 0.24) - hex - isDark - } - social { - type - url - } - sheetsCount - isArtist - isOfficial - likes - seoInfo { - title - description - keywords - imageUrl - } - uploadedInstrumentGroups { - name - instruments { - name + query ArtistDetailLoadUser($artistUrl: String!) { + user(artistUrl: $artistUrl) { + coverUrl + coverImageMeta { + isDark + isLight + startRgba: rgba(opacity: 1) + endRgba: rgba(opacity: 0.24) + } + createdAt + instruments + userId + name + profileUrl + iamUuid + artistUrl + profileImageMeta { + startRgba: rgba(opacity: 1) + endRgba: rgba(opacity: 0.24) + hex + isDark + } + social { + type + url + } + sheetsCount + isArtist + isOfficial + likes + seoInfo { + title + description + keywords + imageUrl + } + uploadedInstrumentGroups { + name + instruments { + name + } + } + } } - } - } - }`, + `, variables: { artistUrl: username, }, @@ -114,37 +115,38 @@ async function handler(ctx) { body: { operationName: 'loadArtistSheets', query: /* GraphQL */ ` - query loadArtistSheets($data: SheetSearchInput!) { - sheetSearch(data: $data) { - list { - productId - productType - metaSong - metaMaker - metaMusician - metaMemo - instruments - createdAt - level - price - sheetId - status - author { - name - artistUrl - profileUrl + query loadArtistSheets($data: SheetSearchInput!) { + sheetSearch(data: $data) { + list { + productId + productType + metaSong + metaMaker + metaMusician + metaMemo + instruments + createdAt + level + price + sheetId + status + author { + name + artistUrl + profileUrl + } + youtubeId + title + supportCountry + excludeCountries + __typename + } + total + current + listNum + } } - youtubeId - title - supportCountry - excludeCountries - __typename - } - total - current - listNum - } - }`, + `, variables: { data: { listNum: 10, diff --git a/lib/routes/xiaote/index.ts b/lib/routes/xiaote/index.ts index 111646c44..4a26ec656 100644 --- a/lib/routes/xiaote/index.ts +++ b/lib/routes/xiaote/index.ts @@ -29,21 +29,23 @@ export const route: Route = { async function handler() { const { data } = await got.post('https://lcen.xiaote.net//api/graphql/', { json: { - query: /* GraphQL */ `query($startCursor: Int) { - communities(startCursor: $startCursor) { - edges { - node { - objectId - content - createdAt - imageUrls - user{ - nickname + query: /* GraphQL */ ` + query ($startCursor: Int) { + communities(startCursor: $startCursor) { + edges { + node { + objectId + content + createdAt + imageUrls + user { + nickname + } } + } } } - } - }`, + `, }, });