Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature/support new tachiyomi backup file extension #430

Merged
merged 2 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/graphql/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}>;


Expand Down Expand Up @@ -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'];
}>;


Expand Down
4 changes: 2 additions & 2 deletions src/lib/graphql/mutations/BackupMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/lib/graphql/queries/BackupQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/lib/requests/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ export class RequestManager {
const result = this.doRequest<RestoreBackupMutation, RestoreBackupMutationVariables>(
GQLMethod.MUTATION,
RESTORE_BACKUP,
{ input: { backup: file } },
{ backup: file },
{
...options,
},
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/Backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down