This repository was archived by the owner on Nov 26, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from codl/archive-warn
warn when archive looks too big
- Loading branch information
Showing
7 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<form action={action} method='post' enctype='multipart/form-data'> | ||
{#if file_too_big} | ||
<div class="banner warning"> | ||
<p>The file you have selected is very large.</p> | ||
|
||
<p>Twitter has two types of archives, <b>Forget does not support | ||
"Your Twitter data" archives, only "Tweet archives"</b> | ||
available from | ||
<a href="https://twitter.com/settings/account#export_request">your account settings</a>. | ||
Please make sure you have the right type of archive.</p> | ||
</div> | ||
{/if} | ||
<input type="file" name="file" accept="application/zip,.zip" | ||
on:change="take_file(this.files)"> | ||
<input type="submit" value="Upload"> | ||
<input type='hidden' name='csrf-token' value={csrf_token}> | ||
</form> | ||
|
||
<script> | ||
function get_file_size(file_list){ | ||
/* returns size of selected file given an <input type="file"> | ||
or 0 if no file is selected */ | ||
let size = 0; | ||
for(let i = 0; i < file_list.length; i++){ | ||
size += file_list[i].size; | ||
} | ||
return size; | ||
} | ||
|
||
|
||
export default { | ||
data(){ | ||
return { file_size: 0 } | ||
}, | ||
|
||
oncreate(){ | ||
}, | ||
|
||
methods: { | ||
take_file(file_list){ | ||
this.set({file_size: get_file_size(file_list)}); | ||
}, | ||
}, | ||
|
||
computed: { | ||
file_too_big: ({file_size}) => file_size > 10000000, // 10 MB | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ export default { | |
plugins: [ | ||
svelte({ | ||
include: 'components/**/*.html', | ||
hydratable: true, | ||
}), | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters