Feature/support new tachiyomi backup file extension (#430)
* [Codegen] Fix restore backup mutation/query The server doesn't support nested objects for file uploads * Support new tachiyomi backup extension
This commit is contained in:
@@ -2094,7 +2094,7 @@ export type CreateBackupMutationVariables = Exact<{
|
||||
export type CreateBackupMutation = { __typename?: 'Mutation', createBackup: { __typename?: 'CreateBackupPayload', clientMutationId?: string | null, url: string } };
|
||||
|
||||
export type RestoreBackupMutationVariables = Exact<{
|
||||
input: RestoreBackupInput;
|
||||
backup: Scalars['Upload']['input'];
|
||||
}>;
|
||||
|
||||
|
||||
@@ -2409,7 +2409,7 @@ export type StopUpdaterMutationVariables = Exact<{
|
||||
export type StopUpdaterMutation = { __typename?: 'Mutation', updateStop: { __typename?: 'UpdateStopPayload', clientMutationId?: string | null } };
|
||||
|
||||
export type ValidateBackupQueryVariables = Exact<{
|
||||
input: ValidateBackupInput;
|
||||
backup: Scalars['Upload']['input'];
|
||||
}>;
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ export const CREATE_BACKUP = gql`
|
||||
`;
|
||||
|
||||
export const RESTORE_BACKUP = gql`
|
||||
mutation RESTORE_BACKUP($input: RestoreBackupInput!) {
|
||||
restoreBackup(input: $input) {
|
||||
mutation RESTORE_BACKUP($backup: Upload!) {
|
||||
restoreBackup(input: { backup: $backup }) {
|
||||
clientMutationId
|
||||
status {
|
||||
mangaProgress
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const VALIDATE_BACKUP = gql`
|
||||
query VALIDATE_BACKUP($input: ValidateBackupInput!) {
|
||||
validateBackup(input: $input) {
|
||||
query VALIDATE_BACKUP($backup: Upload!) {
|
||||
validateBackup(input: { backup: $backup }) {
|
||||
missingSources {
|
||||
id
|
||||
name
|
||||
|
||||
@@ -1571,7 +1571,7 @@ export class RequestManager {
|
||||
const result = this.doRequest<RestoreBackupMutation, RestoreBackupMutationVariables>(
|
||||
GQLMethod.MUTATION,
|
||||
RESTORE_BACKUP,
|
||||
{ input: { backup: file } },
|
||||
{ backup: file },
|
||||
{
|
||||
...options,
|
||||
},
|
||||
@@ -1584,11 +1584,11 @@ export class RequestManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
public useValidateBackupFile(
|
||||
public validateBackupFile(
|
||||
file: File,
|
||||
options?: QueryOptions<ValidateBackupQueryVariables, ValidateBackupQuery>,
|
||||
): AbortabaleApolloQueryResponse<ValidateBackupQuery> {
|
||||
return this.doRequest(GQLMethod.QUERY, VALIDATE_BACKUP, { input: { backup: file } }, options);
|
||||
return this.doRequest(GQLMethod.QUERY, VALIDATE_BACKUP, { backup: file }, options);
|
||||
}
|
||||
|
||||
public getExportBackupUrl(): string {
|
||||
|
||||
@@ -28,7 +28,7 @@ export function Backup() {
|
||||
useSetDefaultBackTo('settings');
|
||||
|
||||
const submitBackup = (file: File) => {
|
||||
if (file.name.toLowerCase().endsWith('proto.gz')) {
|
||||
if (file.name.toLowerCase().match(/proto\.gz$|tachibk$/g)) {
|
||||
makeToast(t('settings.backup.label.restoring_backup'), 'info');
|
||||
requestManager
|
||||
.restoreBackupFile(file)
|
||||
|
||||
Reference in New Issue
Block a user