Quellcode durchsuchen

Merge pull request #507 from transloadit/tus/resume-false-dont-store-url

Tus: `resume: false` — don’t store url
Artur Paikin vor 7 Jahren
Ursprung
Commit
1f3bbb9551

+ 0 - 4
src/plugins/Dashboard/index.js

@@ -211,10 +211,6 @@ module.exports = class Dashboard extends Plugin {
 
     this.updateDashboardElWidth()
     this.setFocusToFirstNode()
-
-    // timeout is needed because yo-yo/morphdom/nanoraf; not needed without nanoraf
-    // setTimeout(this.setFocusToFirstNode, 100)
-    // setTimeout(this.updateDashboardElWidth, 100)
   }
 
   closeModal () {

+ 4 - 2
src/plugins/Tus.js

@@ -326,8 +326,10 @@ module.exports = class Tus extends Plugin {
   onReceiveUploadUrl (file, uploadURL) {
     const currentFile = this.getFile(file.id)
     if (!currentFile) return
-    // Only do the update if we didn't have an upload URL yet.
-    if (!currentFile.tus || currentFile.tus.uploadUrl !== uploadURL) {
+    // Only do the update if we didn't have an upload URL yet,
+    // or resume: false in options
+    if ((!currentFile.tus || currentFile.tus.uploadUrl !== uploadURL) && this.opts.resume) {
+      this.uppy.log('[Tus] Storing upload url')
       const newFile = Object.assign({}, currentFile, {
         tus: Object.assign({}, currentFile.tus, {
           uploadUrl: uploadURL

+ 2 - 2
website/_config.yml

@@ -7,13 +7,13 @@ google_analytics: UA-63083-12
 root_domain: uppy.io
 
 # Site
-title: Uppy
+title: Uppy File Uploader
 subtitle: "Almost as cute as a puppy"
 logo_large: /images/logos/uppy-dog-full.svg
 logo_medium: /images/logos/uppy-dog-head-arrow.svg
 logo_icon: /images/logos/uppy-dog-head-arrow.png
 description: >
-    Uppy is a sleek, modular file uploader that integrates seamlessly with any framework. 
+    Sleek, modular file uploader that integrates seamlessly with any framework. 
     It fetches files from local disk, Google Drive, Dropbox, Instagram, remote URLs, cameras and other exciting locations, and then uploads them to the final destination. 
     It’s fast, easy to use and let's you worry about more important problems than building a file uploader.
 descriptionWho: >

+ 8 - 0
website/src/docs/tus.md

@@ -20,6 +20,14 @@ uppy.use(Tus, {
 
 The Tus plugin supports all of [tus-js-client][]’s options. Additionally:
 
+### `resume: true`
+
+A boolean indicating whether tus should attempt to resume the upload if the upload has been started in the past. This includes storing the file’s upload url. Use false to force an entire reupload.
+
+Note that this option is about resuming when you start an upload again with the same file, or when using [Golden Retriever](/docs/golden-retriever/), which will attempt to restore upload state to what it was before page refresh / browser crash. Even if you set `resume: false` when using Tus uploader, users will still be able to pause/resume an ongoing upload.
+
+In most cases you should leave this option as is, relax, and enjoy resumable uploads.
+
 ### `endpoint: ''`
 
 URL to upload to, where your tus.io server is running.

+ 1 - 1
website/themes/uppy/layout/layout.ejs

@@ -1,6 +1,6 @@
 <% var isIndex = page.path === 'index.html' %>
 <% var title = page.title ? page.title + ' — ' + config.title : config.title %>
-<% var excerpt = page.excerpt ? page.excerpt.replace(/(<([^>]+)>)/ig, '').substring(0, 500) : config.description %>
+<% var excerpt = page.excerpt ? page.excerpt.replace(/(<([^>]+)>)/ig, '').substring(0, 400) : config.description %>
 <% var image = page.image ? page.image : 'http://uppy.io/images/uppy-social.jpg' %>
 
 <!DOCTYPE html>