mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
Merge branch 'remove-angular-eslint' of https://github.com/transloadit/uppy into remove-angular-eslint
This commit is contained in:
commit
11287e1a4c
77 changed files with 134 additions and 1033 deletions
9
.changeset/gold-rice-jog.md
Normal file
9
.changeset/gold-rice-jog.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
"@uppy/components": major
|
||||
"@uppy/companion": major
|
||||
"uppy": major
|
||||
"@uppy/transloadit": minor
|
||||
"@uppy/locales": minor
|
||||
---
|
||||
|
||||
Remove @uppy/instagram references from all the packages
|
||||
5
.changeset/legal-drinks-marry.md
Normal file
5
.changeset/legal-drinks-marry.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@uppy/transloadit": minor
|
||||
---
|
||||
|
||||
Add assemblyStatus and lastAssemblyStatus to transloadit's plugin state
|
||||
|
|
@ -44,9 +44,6 @@ COMPANION_DROPBOX_SECRET=***
|
|||
COMPANION_GOOGLE_KEY=***
|
||||
COMPANION_GOOGLE_SECRET=***
|
||||
|
||||
COMPANION_INSTAGRAM_KEY=***
|
||||
COMPANION_INSTAGRAM_SECRET=***
|
||||
|
||||
COMPANION_FACEBOOK_KEY=***
|
||||
COMPANION_FACEBOOK_SECRET=***
|
||||
|
||||
|
|
|
|||
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
|
|
@ -57,7 +57,7 @@ This is not needed for changing existing components.
|
|||
## Companion
|
||||
|
||||
If you’d like to work on features that the basic development version of Uppy
|
||||
doesn’t support, such as Uppy integrations with Instagram/Google Drive/Facebook
|
||||
doesn’t support, such as Uppy integrations with Google Drive/Facebook
|
||||
etc., you need to set up your `.env` file (copy the contents of `.env.example`
|
||||
and adjust them based on what you need to work on), and run:
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ when files are changed.
|
|||
### How the Authentication and Token mechanism works
|
||||
|
||||
This section describes how Authentication works between Companion and Providers.
|
||||
While this behaviour is the same for all Providers (Dropbox, Instagram, Google
|
||||
While this behaviour is the same for all Providers (Dropbox, Google
|
||||
Drive, etc.), we are going to be referring to Dropbox in place of any Provider
|
||||
throughout this section.
|
||||
|
||||
|
|
|
|||
2
.github/workflows/bundlers.yml
vendored
2
.github/workflows/bundlers.yml
vendored
|
|
@ -42,7 +42,7 @@ jobs:
|
|||
node-version: lts/*
|
||||
- name: Install dependencies
|
||||
run:
|
||||
corepack yarn install
|
||||
corepack yarn install --immutable
|
||||
env:
|
||||
# https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
|
||||
CYPRESS_INSTALL_BINARY: 0
|
||||
|
|
|
|||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
|
@ -47,7 +47,7 @@ jobs:
|
|||
node-version: ${{matrix.node-version}}
|
||||
- name: Install dependencies
|
||||
run:
|
||||
corepack yarn install
|
||||
corepack yarn install --immutable
|
||||
- name: Install Playwright Browsers
|
||||
run: corepack yarn workspace @uppy/dashboard playwright install --with-deps
|
||||
- name: Build
|
||||
|
|
@ -84,7 +84,7 @@ jobs:
|
|||
node-version: lts/*
|
||||
- name: Install dependencies
|
||||
run:
|
||||
corepack yarn install
|
||||
corepack yarn install --immutable
|
||||
- run: corepack yarn run typecheck
|
||||
|
||||
lint_js:
|
||||
|
|
|
|||
52
.github/workflows/companion-deploy.yml
vendored
52
.github/workflows/companion-deploy.yml
vendored
|
|
@ -38,35 +38,49 @@ jobs:
|
|||
path: /tmp/companion-${{ github.sha }}.tar.gz
|
||||
|
||||
docker:
|
||||
name: DockerHub
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_BUILDKIT: 0
|
||||
COMPOSE_DOCKER_CLI_BUILD: 0
|
||||
name: DockerHub (${{ matrix.platform }})
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- runner: ubuntu-24.04
|
||||
platform: linux/amd64
|
||||
platform_tag: amd64
|
||||
- runner: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
platform_tag: arm64
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v6
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||
with:
|
||||
images: transloadit/companion
|
||||
tags: |
|
||||
type=edge
|
||||
type=raw,value=latest,enable=false
|
||||
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
with:
|
||||
username: ${{secrets.DOCKER_USERNAME}}
|
||||
password: ${{secrets.DOCKER_PASSWORD}}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: ${{ matrix.platform }}
|
||||
file: Dockerfile
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
tags: transloadit/companion:edge-${{ matrix.platform_tag }}
|
||||
|
||||
docker-manifest:
|
||||
name: DockerHub manifest
|
||||
needs: docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to DockerHub
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Publish edge manifest
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag transloadit/companion:edge \
|
||||
transloadit/companion:edge-amd64 \
|
||||
transloadit/companion:edge-arm64
|
||||
|
|
|
|||
12
.github/workflows/manual-cdn.yml
vendored
12
.github/workflows/manual-cdn.yml
vendored
|
|
@ -30,18 +30,6 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v6
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run:
|
||||
echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v5
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ inline into the page. This, and many more configuration options can be found
|
|||
here: <https://uppy.io/docs/dashboard/>.
|
||||
|
||||
Uppy has many more Plugins besides Xhr and the Dashboard. For example, you can
|
||||
enable Webcam, Instagram, or video encoding support. Note that for some Plugins,
|
||||
enable Webcam or video encoding support. Note that for some Plugins,
|
||||
you will need to run a server side component called: Companion. Those plugins
|
||||
are marked with a (c) symbol. Alternatively, you can sign up for a free
|
||||
Transloadit account. Transloadit runs Companion for you, tusd servers to handle
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ yarn workspace @uppy/[package-name] build
|
|||
- **Uppy Core** (`@uppy/core`) - Main class that manages plugins, state, and events
|
||||
- **Plugins** - Modular components for different functionalities:
|
||||
- **UI Plugins**: Dashboard, Drag & Drop, File Input, Webcam, etc.
|
||||
- **Provider Plugins**: Google Drive, Dropbox, Instagram, etc. (require Companion)
|
||||
- **Provider Plugins**: Google Drive, Dropbox, etc. (require Companion)
|
||||
- **Uploader Plugins**: Tus (resumable), XHR Upload, AWS S3, etc.
|
||||
- **Utility Plugins**: Golden Retriever (recovery), Thumbnail Generator, etc.
|
||||
|
||||
|
|
|
|||
14
README.md
14
README.md
|
|
@ -7,7 +7,7 @@ with any application. It’s fast, has a comprehensible API and lets you worry
|
|||
about more important problems than building a file uploader.
|
||||
|
||||
- **Fetch** files from local disk, remote URLs, Google Drive, Dropbox, Box,
|
||||
Instagram or snap and record selfies with a camera
|
||||
or snap and record selfies with a camera
|
||||
- **Preview** and edit metadata with a nice interface
|
||||
- **Upload** to the final destination, optionally process/encode
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ For the supported frameworks (except Angular) Uppy offers three ways to build us
|
|||
- Lightweight, modular plugin-based architecture, light on dependencies :zap:
|
||||
- Resumable file uploads via the open [tus](https://tus.io/) standard, so large
|
||||
uploads survive network hiccups
|
||||
- Supports picking files from: Webcam, Dropbox, Box, Google Drive, Instagram,
|
||||
- Supports picking files from: Webcam, Dropbox, Box, Google Drive,
|
||||
bypassing the user’s device where possible, syncing between servers directly
|
||||
via [@uppy/companion](https://uppy.io/docs/companion)
|
||||
- Works great with file encoding and processing backends, such as
|
||||
|
|
@ -140,7 +140,7 @@ CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object.
|
|||
|
||||
- [Uppy](https://uppy.io/docs/uppy/) — full list of options, methods and events
|
||||
- [Companion](https://uppy.io/docs/companion/) — setting up and running a
|
||||
Companion instance, which adds support for Instagram, Dropbox, Box, Google
|
||||
Companion instance, which adds support for Dropbox, Box, Google
|
||||
Drive and remote URLs
|
||||
- [React](https://uppy.io/docs/react/) — components to integrate Uppy UI plugins
|
||||
with React apps
|
||||
|
|
@ -153,7 +153,7 @@ CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object.
|
|||
|
||||
- [`Dashboard`](https://uppy.io/docs/dashboard/) — universal UI with previews,
|
||||
progress bars, metadata editor and all the cool stuff. Required for most UI
|
||||
plugins like Webcam and Instagram
|
||||
plugins like Webcam
|
||||
- Headless components ([react](https://uppy.io/docs/react/), [svelte](https://uppy.io/docs/svelte/), [vue](https://uppy.io/docs/vue/))
|
||||
|
||||
### Sources
|
||||
|
|
@ -166,8 +166,6 @@ CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object.
|
|||
Google Drive
|
||||
- ⓒ [`Dropbox`](https://uppy.io/docs/dropbox/) — import files from Dropbox
|
||||
- ⓒ [`Box`](https://uppy.io/docs/box/) — import files from Box
|
||||
- ⓒ [`Instagram`](https://uppy.io/docs/instagram/) — import images and videos
|
||||
from Instagram
|
||||
- ⓒ [`Facebook`](https://uppy.io/docs/facebook/) — import images and videos from
|
||||
Facebook
|
||||
- ⓒ [`OneDrive`](https://uppy.io/docs/onedrive/) — import files from Microsoft
|
||||
|
|
@ -222,7 +220,7 @@ cases, the file input leaves some to be desired:
|
|||
- Uppy supports editing meta information before uploading.
|
||||
- Uppy allows cropping images before uploading.
|
||||
- There’s the situation where people are using their mobile devices and want to
|
||||
upload on the go, but they have their picture on Instagram, files in Dropbox
|
||||
upload on the go, but they have files in Dropbox
|
||||
or a plain file URL from anywhere on the open web. Uppy allows to pick files
|
||||
from those and push it to the destination without downloading it to your
|
||||
mobile device first.
|
||||
|
|
@ -272,7 +270,7 @@ If you want resumability with the Tus plugin, use
|
|||
[one of the tus server implementations](https://tus.io/implementations.html) 👌🏼
|
||||
|
||||
And you’ll need [`@uppy/companion`](https://uppy.io/docs/companion) if you’d
|
||||
like your users to be able to pick files from Instagram, Google Drive, Dropbox
|
||||
like your users to be able to pick files from Google Drive, Dropbox
|
||||
or via direct URLs (with more services coming).
|
||||
|
||||
## Contributions are welcome
|
||||
|
|
|
|||
|
|
@ -16,17 +16,12 @@
|
|||
import {
|
||||
Uppy,
|
||||
Dashboard,
|
||||
Instagram,
|
||||
GoogleDrive,
|
||||
Tus,
|
||||
} from 'https://releases.transloadit.com/uppy/v4.18.0/uppy.min.mjs'
|
||||
|
||||
const uppy = new Uppy({ debug: true, autoProceed: false })
|
||||
.use(Dashboard, { trigger: '#uppyModalOpener' })
|
||||
.use(Instagram, {
|
||||
target: Dashboard,
|
||||
companionUrl: 'http://localhost:3020',
|
||||
})
|
||||
.use(GoogleDrive, {
|
||||
target: Dashboard,
|
||||
companionUrl: 'http://localhost:3020',
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ const companionOptions = {
|
|||
key: 'your google key',
|
||||
secret: 'your google secret',
|
||||
},
|
||||
instagram: {
|
||||
key: 'your instagram key',
|
||||
secret: 'your instagram secret',
|
||||
},
|
||||
dropbox: {
|
||||
key: 'your dropbox key',
|
||||
secret: 'your dropbox secret',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "@uppy-dev/build",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
|
||||
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox, Google Drive, S3 and more :dog:",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"examples/*",
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ data:
|
|||
COMPANION_BOX_SECRET: 'YOUR BOX SECRET'
|
||||
COMPANION_GOOGLE_KEY: 'YOUR GOOGLE KEY'
|
||||
COMPANION_GOOGLE_SECRET: 'YOUR GOOGLE SECRET'
|
||||
COMPANION_INSTAGRAM_KEY: 'YOUR INSTAGRAM KEY'
|
||||
COMPANION_INSTAGRAM_SECRET: 'YOUR INSTAGRAM SECRET'
|
||||
COMPANION_AWS_KEY: 'YOUR AWS KEY'
|
||||
COMPANION_AWS_SECRET: 'YOUR AWS SECRET'
|
||||
COMPANION_AWS_BUCKET: 'YOUR AWS S3 BUCKET'
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Companion is a server integration for
|
|||
[Uppy](https://github.com/transloadit/uppy) file uploader.
|
||||
|
||||
It handles the server-to-server communication between your server and file
|
||||
storage providers such as Google Drive, Dropbox, Instagram, etc. **Companion is
|
||||
storage providers such as Google Drive, Dropbox, etc. **Companion is
|
||||
not a target to upload files to**. For this, use a <https://tus.io> server (if
|
||||
you want resumable) or your existing Apache/Nginx server (if you don’t).
|
||||
[See here for full documentation](https://uppy.io/docs/companion/)
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ COMPANION_GOOGLE_KEY=
|
|||
COMPANION_GOOGLE_SECRET=
|
||||
COMPANION_GOOGLE_SECRET_FILE=
|
||||
|
||||
COMPANION_INSTAGRAM_KEY=
|
||||
COMPANION_INSTAGRAM_SECRET=
|
||||
COMPANION_INSTAGRAM_SECRET_FILE=
|
||||
|
||||
COMPANION_FACEBOOK_KEY=
|
||||
COMPANION_FACEBOOK_SECRET=
|
||||
COMPANION_FACEBOOK_SECRET_FILE=
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@ export default function grantConfig(): GrantStaticConfig {
|
|||
access_url: 'https://api.box.com/oauth2/token',
|
||||
callback: '/box/callback',
|
||||
},
|
||||
instagram: {
|
||||
...defaults,
|
||||
callback: '/instagram/callback',
|
||||
},
|
||||
facebook: {
|
||||
...defaults,
|
||||
scope: ['email', 'user_photos'],
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ export default class Uploader {
|
|||
/**
|
||||
* Uploads file to destination based on the supplied protocol (tus, s3-multipart, multipart)
|
||||
* For tus uploads, the deferredLength option is enabled, because file size value can be unreliable
|
||||
* for some providers (Instagram particularly)
|
||||
* for some providers.
|
||||
*
|
||||
* @param optionsIn
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { getCredentialsResolver } from './credentials.js'
|
|||
import dropbox from './dropbox/index.js'
|
||||
import facebook from './facebook/index.js'
|
||||
import { Drive } from './google/drive/index.js'
|
||||
import instagram from './instagram/graph/index.js'
|
||||
import onedrive from './onedrive/index.js'
|
||||
import { isOAuthProvider, type ProviderCtor } from './Provider.js'
|
||||
import unsplash from './unsplash/index.js'
|
||||
|
|
@ -113,7 +112,6 @@ export function getDefaultProviders() {
|
|||
facebook,
|
||||
onedrive,
|
||||
zoom,
|
||||
instagram,
|
||||
unsplash,
|
||||
webdav,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
import querystring from 'node:querystring'
|
||||
|
||||
const MEDIA_TYPES = Object.freeze({
|
||||
video: 'VIDEO',
|
||||
carousel: 'CAROUSEL_ALBUM',
|
||||
image: 'IMAGE',
|
||||
})
|
||||
|
||||
type InstagramMedia = {
|
||||
id: string
|
||||
media_type: string
|
||||
media_url?: string
|
||||
thumbnail_url?: string
|
||||
timestamp: string
|
||||
children?: { data: InstagramMedia[] }
|
||||
}
|
||||
|
||||
type InstagramListResponse = {
|
||||
data: InstagramMedia[]
|
||||
paging?: { cursors?: { after?: string } }
|
||||
}
|
||||
|
||||
const isVideo = (item: InstagramMedia): boolean =>
|
||||
item.media_type === MEDIA_TYPES.video
|
||||
|
||||
const isFolder = (_item: InstagramMedia): boolean => {
|
||||
return false
|
||||
}
|
||||
|
||||
const getItemIcon = (item: InstagramMedia): string | undefined => {
|
||||
return isVideo(item) ? item.thumbnail_url : item.media_url
|
||||
}
|
||||
|
||||
const getItemSubList = (item: InstagramListResponse): InstagramMedia[] => {
|
||||
const newItems: InstagramMedia[] = []
|
||||
item.data.forEach((subItem) => {
|
||||
if (subItem.media_type === MEDIA_TYPES.carousel) {
|
||||
subItem.children?.data.forEach((i) => newItems.push(i))
|
||||
} else {
|
||||
newItems.push(subItem)
|
||||
}
|
||||
})
|
||||
return newItems
|
||||
}
|
||||
|
||||
const getItemName = (item: InstagramMedia, index: number): string => {
|
||||
const ext = isVideo(item) ? 'mp4' : 'jpeg'
|
||||
// adding index, so the name is unique
|
||||
return `Instagram ${item.timestamp}${index}.${ext}`
|
||||
}
|
||||
|
||||
const getMimeType = (item: InstagramMedia): string => {
|
||||
return isVideo(item) ? 'video/mp4' : 'image/jpeg'
|
||||
}
|
||||
|
||||
const getItemId = (item: InstagramMedia): string => item.id
|
||||
|
||||
const getItemRequestPath = (item: InstagramMedia): string => item.id
|
||||
|
||||
const getItemModifiedDate = (item: InstagramMedia): string => item.timestamp
|
||||
|
||||
const getItemThumbnailUrl = (item: InstagramMedia): string | undefined =>
|
||||
getItemIcon(item)
|
||||
|
||||
const getNextPagePath = (
|
||||
data: InstagramListResponse,
|
||||
currentQuery: Record<string, string>,
|
||||
currentPath: string | undefined,
|
||||
): string | null => {
|
||||
if (!data.paging || !data.paging.cursors) {
|
||||
return null
|
||||
}
|
||||
|
||||
const after = data.paging.cursors.after
|
||||
if (after == null || after.length === 0) return null
|
||||
|
||||
const query = { ...currentQuery, cursor: after }
|
||||
return `${currentPath || ''}?${querystring.stringify(query)}`
|
||||
}
|
||||
|
||||
const adaptData = (
|
||||
res: InstagramListResponse,
|
||||
username: string | null,
|
||||
directory: string | undefined,
|
||||
currentQuery: Record<string, string>,
|
||||
) => {
|
||||
const items = getItemSubList(res).map((item, i) => ({
|
||||
isFolder: isFolder(item),
|
||||
icon: getItemIcon(item),
|
||||
name: getItemName(item, i),
|
||||
mimeType: getMimeType(item),
|
||||
id: getItemId(item),
|
||||
size: null,
|
||||
thumbnail: getItemThumbnailUrl(item),
|
||||
requestPath: getItemRequestPath(item),
|
||||
modifiedDate: getItemModifiedDate(item),
|
||||
}))
|
||||
|
||||
const nextPagePath = getNextPagePath(res, currentQuery, directory)
|
||||
return { username, items, nextPagePath }
|
||||
}
|
||||
|
||||
export default adaptData
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
import type { Readable } from 'node:stream'
|
||||
import got from 'got'
|
||||
import { isRecord } from '../../../helpers/type-guards.js'
|
||||
import { prepareStream } from '../../../helpers/utils.js'
|
||||
import logger from '../../../logger.js'
|
||||
import Provider, {
|
||||
type ProviderListResponse,
|
||||
type Query,
|
||||
} from '../../Provider.js'
|
||||
import { withProviderErrorHandling } from '../../providerErrors.js'
|
||||
import adaptData from './adapter.js'
|
||||
|
||||
type InstagramClient = ReturnType<typeof got.extend>
|
||||
|
||||
interface InstagramUserSession {
|
||||
accessToken: string
|
||||
}
|
||||
|
||||
const getClient = ({ token }: { token: string }): InstagramClient =>
|
||||
got.extend({
|
||||
prefixUrl: 'https://graph.instagram.com',
|
||||
headers: {
|
||||
authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
|
||||
async function getMediaUrl({
|
||||
token,
|
||||
id,
|
||||
}: {
|
||||
token: string
|
||||
id: string
|
||||
}): Promise<string> {
|
||||
const body = await getClient({ token })
|
||||
.get(String(id), {
|
||||
searchParams: { fields: 'media_url' },
|
||||
responseType: 'json',
|
||||
})
|
||||
.json<{ media_url: string }>()
|
||||
|
||||
return body.media_url
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapter for API https://developers.facebook.com/docs/instagram-api/overview
|
||||
*/
|
||||
export default class Instagram extends Provider<InstagramUserSession> {
|
||||
// for "grant"
|
||||
static override getExtraGrantConfig() {
|
||||
return {
|
||||
protocol: 'https',
|
||||
scope: ['user_profile', 'user_media'],
|
||||
}
|
||||
}
|
||||
|
||||
static override get oauthProvider() {
|
||||
return 'instagram'
|
||||
}
|
||||
|
||||
override async list({
|
||||
directory,
|
||||
providerUserSession: { accessToken: token },
|
||||
query,
|
||||
}: {
|
||||
directory?: string | undefined
|
||||
providerUserSession: InstagramUserSession
|
||||
query?: Query | undefined
|
||||
}): Promise<ProviderListResponse> {
|
||||
return this.#withErrorHandling(
|
||||
'provider.instagram.list.error',
|
||||
async () => {
|
||||
const qs: Record<string, string> = {
|
||||
fields:
|
||||
'id,media_type,thumbnail_url,media_url,timestamp,children{media_type,media_url,thumbnail_url,timestamp}',
|
||||
}
|
||||
|
||||
if (typeof query?.['cursor'] === 'string') {
|
||||
qs['after'] = query['cursor']
|
||||
}
|
||||
|
||||
const client = getClient({ token })
|
||||
|
||||
const [me, list] = await Promise.all([
|
||||
client
|
||||
.get('me', {
|
||||
searchParams: { fields: 'username' },
|
||||
responseType: 'json',
|
||||
})
|
||||
.json<{ username?: string }>(),
|
||||
client
|
||||
.get('me/media', { searchParams: qs, responseType: 'json' })
|
||||
.json<Parameters<typeof adaptData>[0]>(),
|
||||
])
|
||||
|
||||
const username = me.username != null ? me.username : null
|
||||
const currentQuery: Record<string, string> = {}
|
||||
if (typeof query?.['cursor'] === 'string')
|
||||
currentQuery['cursor'] = query['cursor']
|
||||
return adaptData(list, username, directory, currentQuery)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override async download({
|
||||
id,
|
||||
providerUserSession: { accessToken: token },
|
||||
}: {
|
||||
id: string
|
||||
providerUserSession: InstagramUserSession
|
||||
}): Promise<{ stream: Readable; size: number | undefined }> {
|
||||
return this.#withErrorHandling(
|
||||
'provider.instagram.download.error',
|
||||
async () => {
|
||||
const url = await getMediaUrl({ token, id })
|
||||
const stream = got.stream.get(url, { responseType: 'json' })
|
||||
const { size } = await prepareStream(stream)
|
||||
return { stream, size }
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override async thumbnail(): Promise<{
|
||||
stream: Readable
|
||||
contentType: string
|
||||
}> {
|
||||
// not implementing this because a public thumbnail from instagram will be used instead
|
||||
logger.error(
|
||||
'call to thumbnail is not implemented',
|
||||
'provider.instagram.thumbnail.error',
|
||||
)
|
||||
throw new Error('call to thumbnail is not implemented')
|
||||
}
|
||||
|
||||
override async logout() {
|
||||
// access revoke is not supported by Instagram's API
|
||||
return {
|
||||
revoked: false,
|
||||
manual_revoke_url: 'https://www.instagram.com/accounts/manage_access/',
|
||||
}
|
||||
}
|
||||
|
||||
async #withErrorHandling<T>(tag: string, fn: () => Promise<T>): Promise<T> {
|
||||
return withProviderErrorHandling({
|
||||
fn,
|
||||
tag,
|
||||
providerName: Instagram.oauthProvider,
|
||||
isAuthError: (response) => {
|
||||
const body = response.body
|
||||
if (!isRecord(body)) return false
|
||||
const err = body['error']
|
||||
return isRecord(err) && err['code'] === 190
|
||||
}, // Invalid OAuth 2.0 Access Token
|
||||
getJsonErrorMessage: (body) => {
|
||||
if (!isRecord(body)) return undefined
|
||||
const err = body['error']
|
||||
if (!isRecord(err)) return undefined
|
||||
return typeof err['message'] === 'string' ? err['message'] : undefined
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -145,11 +145,6 @@ const getConfigFromEnv = (): StandaloneCompanionOptions => {
|
|||
secret: getSecret('COMPANION_BOX_SECRET'),
|
||||
credentialsURL: process.env['COMPANION_BOX_KEYS_ENDPOINT'],
|
||||
},
|
||||
instagram: {
|
||||
key: process.env['COMPANION_INSTAGRAM_KEY'],
|
||||
secret: getSecret('COMPANION_INSTAGRAM_SECRET'),
|
||||
credentialsURL: process.env['COMPANION_INSTAGRAM_KEYS_ENDPOINT'],
|
||||
},
|
||||
facebook: {
|
||||
key: process.env['COMPANION_FACEBOOK_KEY'],
|
||||
secret: getSecret('COMPANION_FACEBOOK_SECRET'),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import * as constants from './constants.js'
|
|||
import * as drive from './drive.js'
|
||||
import * as dropbox from './dropbox.js'
|
||||
import * as facebook from './facebook.js'
|
||||
import * as instagram from './instagram.js'
|
||||
import * as onedrive from './onedrive.js'
|
||||
import * as zoom from './zoom.js'
|
||||
|
||||
|
|
@ -11,7 +10,6 @@ export const providers = {
|
|||
box,
|
||||
drive,
|
||||
dropbox,
|
||||
instagram,
|
||||
onedrive,
|
||||
facebook,
|
||||
zoom,
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
export const expects: {
|
||||
itemName: string
|
||||
itemMimeType: string
|
||||
itemSize: null
|
||||
} = {
|
||||
itemName: 'Instagram 2017-08-31T18:10:00+00000.jpeg',
|
||||
itemMimeType: 'image/jpeg',
|
||||
itemSize: null,
|
||||
}
|
||||
|
|
@ -37,11 +37,6 @@ const defaultEnv = {
|
|||
COMPANION_GOOGLE_KEYS_ENDPOINT: undefined,
|
||||
COMPANION_GOOGLE_SECRET_FILE: undefined,
|
||||
|
||||
COMPANION_INSTAGRAM_KEY: 'instagram_key',
|
||||
COMPANION_INSTAGRAM_SECRET: 'instagram_secret',
|
||||
COMPANION_INSTAGRAM_KEYS_ENDPOINT: undefined,
|
||||
COMPANION_INSTAGRAM_SECRET_FILE: undefined,
|
||||
|
||||
COMPANION_FACEBOOK_KEY: 'facebook_key',
|
||||
COMPANION_FACEBOOK_SECRET: 'facebook_secret',
|
||||
COMPANION_FACEBOOK_KEYS_ENDPOINT: undefined,
|
||||
|
|
|
|||
|
|
@ -74,32 +74,17 @@ describe('Test Provider options', () => {
|
|||
|
||||
expect(googledrive['secret']).toBe('google_secret')
|
||||
|
||||
const instagram = requireGrantProviderConfig(grantConfig, 'instagram')
|
||||
expect(instagram['key']).toBe('instagram_key')
|
||||
expect(instagram['secret']).toBe('instagram_secret')
|
||||
|
||||
const zoom = requireGrantProviderConfig(grantConfig, 'zoom')
|
||||
expect(zoom['key']).toBe('zoom_key')
|
||||
expect(zoom['secret']).toBe('zoom_secret')
|
||||
})
|
||||
|
||||
test('adds extra provider config', () => {
|
||||
process.env['COMPANION_INSTAGRAM_KEY'] = '123456'
|
||||
providerManager.addProviderOptions(
|
||||
getAddProviderOptionsArgs(getCompanionOptions()),
|
||||
grantConfig,
|
||||
getOauthProvider,
|
||||
)
|
||||
expect(requireGrantProviderConfig(grantConfig, 'instagram')).toEqual({
|
||||
transport: 'session',
|
||||
state: true,
|
||||
callback: '/instagram/callback',
|
||||
redirect_uri: 'http://localhost:3020/instagram/redirect',
|
||||
key: '123456',
|
||||
secret: 'instagram_secret',
|
||||
protocol: 'https',
|
||||
scope: ['user_profile', 'user_media'],
|
||||
})
|
||||
|
||||
expect(requireGrantProviderConfig(grantConfig, 'dropbox')).toEqual({
|
||||
key: 'dropbox_key',
|
||||
|
|
@ -164,8 +149,6 @@ describe('Test Provider options', () => {
|
|||
`${process.env['PWD']}/test/resources/box_secret_file`
|
||||
process.env['COMPANION_GOOGLE_SECRET_FILE'] =
|
||||
`${process.env['PWD']}/test/resources/google_secret_file`
|
||||
process.env['COMPANION_INSTAGRAM_SECRET_FILE'] =
|
||||
`${process.env['PWD']}/test/resources/instagram_secret_file`
|
||||
process.env['COMPANION_ZOOM_SECRET_FILE'] =
|
||||
`${process.env['PWD']}/test/resources/zoom_secret_file`
|
||||
process.env['COMPANION_ZOOM_VERIFICATION_TOKEN_FILE'] =
|
||||
|
|
@ -188,9 +171,6 @@ describe('Test Provider options', () => {
|
|||
expect(
|
||||
requireGrantProviderConfig(grantConfig, 'googledrive')['secret'],
|
||||
).toBe('elgoog')
|
||||
expect(requireGrantProviderConfig(grantConfig, 'instagram')['secret']).toBe(
|
||||
'margatsni',
|
||||
)
|
||||
expect(requireGrantProviderConfig(grantConfig, 'zoom')['secret']).toBe(
|
||||
'u8Z5ceq',
|
||||
)
|
||||
|
|
@ -232,13 +212,6 @@ describe('Test Provider options', () => {
|
|||
getGrantProviderField(grantConfig, 'googledrive', 'secret'),
|
||||
).toBeUndefined()
|
||||
|
||||
expect(
|
||||
getGrantProviderField(grantConfig, 'instagram', 'key'),
|
||||
).toBeUndefined()
|
||||
expect(
|
||||
getGrantProviderField(grantConfig, 'instagram', 'secret'),
|
||||
).toBeUndefined()
|
||||
|
||||
expect(getGrantProviderField(grantConfig, 'zoom', 'key')).toBeUndefined()
|
||||
expect(getGrantProviderField(grantConfig, 'zoom', 'secret')).toBeUndefined()
|
||||
})
|
||||
|
|
@ -262,9 +235,6 @@ describe('Test Provider options', () => {
|
|||
expect(
|
||||
requireGrantProviderConfig(grantConfig, 'googledrive')['redirect_uri'],
|
||||
).toBe('http://domain.com/drive/redirect')
|
||||
expect(
|
||||
requireGrantProviderConfig(grantConfig, 'instagram')['redirect_uri'],
|
||||
).toBe('http://domain.com/instagram/redirect')
|
||||
expect(
|
||||
requireGrantProviderConfig(grantConfig, 'zoom')['redirect_uri'],
|
||||
).toBe('http://domain.com/zoom/redirect')
|
||||
|
|
|
|||
|
|
@ -316,30 +316,6 @@ describe('list provider files', () => {
|
|||
expect1({ username, items, providerFixture })
|
||||
})
|
||||
|
||||
test('instagram', async () => {
|
||||
nock('https://graph.instagram.com').get('/me?fields=username').reply(200, {
|
||||
id: '17841405793187218',
|
||||
username: defaults.USERNAME,
|
||||
})
|
||||
nock('https://graph.instagram.com')
|
||||
.get(
|
||||
'/me/media?fields=id%2Cmedia_type%2Cthumbnail_url%2Cmedia_url%2Ctimestamp%2Cchildren%7Bmedia_type%2Cmedia_url%2Cthumbnail_url%2Ctimestamp%7D',
|
||||
)
|
||||
.reply(200, {
|
||||
data: [
|
||||
{
|
||||
id: defaults.ITEM_ID,
|
||||
media_type: 'IMAGE',
|
||||
timestamp: '2017-08-31T18:10:00+0000',
|
||||
media_url: defaults.THUMBNAIL_URL,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const { username, items, providerFixture } = await runTest('instagram')
|
||||
expect1({ username, items, providerFixture })
|
||||
})
|
||||
|
||||
test('onedrive', async () => {
|
||||
nock('https://graph.microsoft.com').get('/v1.0/me').reply(200, {
|
||||
userPrincipalName: defaults.USERNAME,
|
||||
|
|
@ -490,20 +466,6 @@ describe('provider file gets downloaded from', () => {
|
|||
await runTest('facebook')
|
||||
})
|
||||
|
||||
test('instagram', async () => {
|
||||
// times(2) because of size request
|
||||
nock('https://graph.instagram.com')
|
||||
.get(`/${defaults.ITEM_ID}?fields=media_url`)
|
||||
.times(2)
|
||||
.reply(200, {
|
||||
id: defaults.ITEM_ID,
|
||||
media_type: 'IMAGE',
|
||||
media_url: defaults.THUMBNAIL_URL,
|
||||
timestamp: '2017-08-31T18:10:00+0000',
|
||||
})
|
||||
await runTest('instagram')
|
||||
})
|
||||
|
||||
test('onedrive', async () => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.get(`/v1.0/drives/DUMMY-DRIVE-ID/items/${defaults.ITEM_ID}`)
|
||||
|
|
@ -609,10 +571,6 @@ describe('logout of provider', () => {
|
|||
await runTest('facebook')
|
||||
})
|
||||
|
||||
test('instagram', async () => {
|
||||
await runTest('instagram')
|
||||
})
|
||||
|
||||
test('onedrive', async () => {
|
||||
await runTest('onedrive')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
margatsni
|
||||
|
|
@ -8,7 +8,6 @@ export type ProviderIconProps = {
|
|||
| 'audio'
|
||||
| 'dropbox'
|
||||
| 'facebook'
|
||||
| 'instagram'
|
||||
| 'onedrive'
|
||||
| 'googlephotos'
|
||||
| 'googledrive'
|
||||
|
|
@ -94,36 +93,6 @@ export default function ProviderIcon(props: ProviderIconProps) {
|
|||
</g>
|
||||
</svg>
|
||||
)
|
||||
case 'instagram':
|
||||
return (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<defs>
|
||||
<path
|
||||
d="M16.825 5l.483-.001.799.002c1.168.005 1.598.021 2.407.057 1.17.05 1.97.235 2.67.506.725.28 1.34.655 1.951 1.265.613.61.99 1.223 1.273 1.946.273.7.46 1.498.516 2.67l.025.552.008.205c.029.748.037 1.51.042 3.777l.001.846v.703l-.001.398a50.82 50.82 0 01-.058 2.588c-.05 1.17-.235 1.97-.506 2.67a5.394 5.394 0 01-1.265 1.951c-.61.613-1.222.99-1.946 1.273-.699.273-1.498.46-2.668.516-.243.012-.451.022-.656.03l-.204.007c-.719.026-1.512.034-3.676.038l-.847.001h-1.1a50.279 50.279 0 01-2.587-.059c-1.171-.05-1.971-.235-2.671-.506a5.394 5.394 0 01-1.951-1.265 5.385 5.385 0 01-1.272-1.946c-.274-.699-.46-1.498-.517-2.668a88.15 88.15 0 01-.03-.656l-.007-.205c-.026-.718-.034-1.512-.038-3.674v-2.129c.006-1.168.022-1.597.058-2.406.051-1.171.235-1.971.506-2.672a5.39 5.39 0 011.265-1.95 5.381 5.381 0 011.946-1.272c.699-.274 1.498-.462 2.669-.517l.656-.03.204-.007c.718-.026 1.511-.034 3.674-.038zm.678 1.981h-1.226l-.295.001c-2.307.005-3.016.013-3.777.043l-.21.009-.457.02c-1.072.052-1.654.232-2.042.383-.513.2-.879.44-1.263.825a3.413 3.413 0 00-.82 1.267c-.15.388-.33.97-.375 2.043a48.89 48.89 0 00-.056 2.482v.398 1.565c.006 2.937.018 3.285.073 4.444.05 1.073.231 1.654.382 2.043.2.512.44.878.825 1.263.386.383.753.621 1.267.82.388.15.97.328 2.043.374.207.01.388.017.563.024l.208.007a63.28 63.28 0 002.109.026h1.564c2.938-.006 3.286-.019 4.446-.073 1.071-.051 1.654-.232 2.04-.383.514-.2.88-.44 1.264-.825.384-.386.622-.753.82-1.266.15-.389.328-.971.375-2.044.039-.88.054-1.292.057-2.723v-1.15-.572c-.006-2.936-.019-3.284-.074-4.445-.05-1.071-.23-1.654-.382-2.04-.2-.515-.44-.88-.825-1.264a3.405 3.405 0 00-1.267-.82c-.388-.15-.97-.328-2.042-.375a48.987 48.987 0 00-2.535-.056zm-1.515 3.37a5.65 5.65 0 11.021 11.299 5.65 5.65 0 01-.02-11.3zm.004 1.982a3.667 3.667 0 10.015 7.334 3.667 3.667 0 00-.015-7.334zm5.865-3.536a1.32 1.32 0 11.005 2.64 1.32 1.32 0 01-.005-2.64z"
|
||||
id="a"
|
||||
/>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<mask id="b" fill="#fff">
|
||||
<use xlinkHref="#a" />
|
||||
</mask>
|
||||
<image
|
||||
mask="url(#b)"
|
||||
x="4"
|
||||
y="4"
|
||||
width="24"
|
||||
height="24"
|
||||
xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALKADAAQAAAABAAAALAAAAAD8buejAAALZklEQVRYCVWZC2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/I/F7MUG9OlrmDrBLRVd3c8KBJlPEKoVRcIJuhoQAmZDUkPC00W5OI1dOpQ1F61kFNqr9SmFcaHdBheOaDHF6QZMOP6QyiZ804oj98wLiAMIgcWw4UDYkDAWfR+4d5s0zP2GgUZX04i+NeSgYGokvbDhIZYUWHgd9K8zZzir264NxZUFbsfM1jdqpV2naA48tx6hsvBSabE4IMtlcOGgq8PqCjoly2rw2soqy4RJWQtPZl6PUCU14ZUWENuZV2Honn3f+k6R6wrkqgTStyQ0bFY+XAaafMRFgUlVeXxXFUcpLEYfZz3FrVUzZrOOJK+4B/wnIZ8TGRvb9OB8EUM0w8uNYj/oa9iK9AMoy6gA72o02srMxpAPUD+EDnVEF7P5xw896VyAbFk8MgnpVpR3gfLnt/wECq3rYFvYLcKCpqvcI+/hVl8AumXDeApklDRRKJSS+KOaq1Rgg4igOYtiQK1hJy46TBtDjznDp3iqJff5j0/LfSZbYVdauqXccJ9W+czupp0sU9gMlqkQ52lU1E6tUwoDUukAD6YRpAwqDrAErzA8QCRvXm98KEep0xIdY1CN1ye27IP0IHvvYIW18qGz8S7VWUZuMkUOb3P8DHTl67ur/i1UAAAAASUVORK5CYII="
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
)
|
||||
case 'onedrive':
|
||||
return (
|
||||
<svg
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ export type RemoteSourceKeys =
|
|||
| 'Dropbox'
|
||||
| 'Facebook'
|
||||
| 'GoogleDrive'
|
||||
| 'Instagram'
|
||||
| 'OneDrive'
|
||||
| 'Unsplash'
|
||||
| 'Url'
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ Uppy is a sleek, modular JavaScript file uploader that integrates seamlessly
|
|||
with any application. It’s fast, provides a comprehensible API and lets you
|
||||
worry about more important problems than building a file uploader.
|
||||
|
||||
- **Fetch** files from local disk, remote urls, Google Drive, Dropbox,
|
||||
Instagram, or snap and record selfies with a camera;
|
||||
- **Fetch** files from local disk, remote urls, Google Drive, Dropbox, or snap
|
||||
and record selfies with a camera;
|
||||
- **Preview** and edit metadata with a nice interface;
|
||||
- **Upload** to the final destination, optionally process/encode
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@uppy/core",
|
||||
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
|
||||
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox, Google Drive, S3 and more :dog:",
|
||||
"version": "5.2.0",
|
||||
"license": "MIT",
|
||||
"style": "dist/style.min.css",
|
||||
|
|
|
|||
|
|
@ -1962,7 +1962,7 @@ describe('src/Core', () => {
|
|||
})
|
||||
|
||||
core.addFile({
|
||||
source: 'instagram',
|
||||
source: 'dropbox',
|
||||
name: 'foo.jpg',
|
||||
type: 'image/jpeg',
|
||||
// @ts-ignore
|
||||
|
|
@ -2028,7 +2028,7 @@ describe('src/Core', () => {
|
|||
})
|
||||
})
|
||||
core.addFile({
|
||||
source: 'instagram',
|
||||
source: 'dropbox',
|
||||
name: 'foo.jpg',
|
||||
type: 'image/jpeg',
|
||||
// @ts-ignore
|
||||
|
|
@ -2045,7 +2045,7 @@ describe('src/Core', () => {
|
|||
})
|
||||
})
|
||||
core.addFile({
|
||||
source: 'instagram',
|
||||
source: 'dropbox',
|
||||
name: 'bar.jpg',
|
||||
type: 'image/jpeg',
|
||||
// @ts-ignore
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
Dashboard is a universal UI plugin for Uppy:
|
||||
|
||||
- Drag and Drop, paste, select from local disk / my device
|
||||
- UI for Webcam and remote sources: Google Drive, Dropbox, Instagram (all
|
||||
optional, added via plugins)
|
||||
- UI for Webcam and remote sources: Google Drive, Dropbox (all optional, added
|
||||
via plugins)
|
||||
- File previews and info
|
||||
- Metadata editor
|
||||
- Progress: total and for individual files
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ function focusOnLastNode(event: $TSFixMe, nodes: $TSFixMe) {
|
|||
// Firefox thinks <ul> is focusable, but we don't have <ul>s in our FOCUSABLE_ELEMENTS. Which means that if we tab into
|
||||
// the <ul>, code will think that we are not in the active overlay, and we should focusOnFirstNode() of the currently
|
||||
// active overlay!
|
||||
// [Practical check] if we use (focusedItemIndex === -1), instagram provider in firefox will never get focus on its pics
|
||||
// in the <ul>.
|
||||
function isFocusInOverlay(activeOverlayEl: $TSFixMe) {
|
||||
return activeOverlayEl.contains(document.activeElement)
|
||||
}
|
||||
|
|
@ -60,7 +58,7 @@ function trapFocus(
|
|||
}
|
||||
}
|
||||
|
||||
// Traps focus inside of the currently open overlay (e.g. Dashboard, or e.g. Instagram),
|
||||
// Traps focus inside of the currently open overlay (e.g. Dashboard),
|
||||
// never lets focus disappear from the modal.
|
||||
export { trapFocus as forModal }
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
tsconfig.*
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
# @uppy/instagram
|
||||
|
||||
## 5.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 79e6460: - Add PluginTypeRegistry and typed getPlugin overload in @uppy/core
|
||||
- Register plugin ids across packages so uppy.getPlugin('Dashboard' | 'Webcam') returns the concrete plugin type and removes the need to pass generics in getPlugin()
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e661348]
|
||||
- Updated dependencies [79e6460]
|
||||
- Updated dependencies [ac12f35]
|
||||
- Updated dependencies [4817585]
|
||||
- @uppy/provider-views@5.2.0
|
||||
- @uppy/core@5.2.0
|
||||
- @uppy/utils@7.1.4
|
||||
|
||||
## 5.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 975317d: Removed "main" from package.json, since export maps serve as the contract for the public API.
|
||||
- Updated dependencies [4b6a76c]
|
||||
- Updated dependencies [975317d]
|
||||
- Updated dependencies [9bac4c8]
|
||||
- @uppy/core@5.0.2
|
||||
- @uppy/companion-client@5.0.1
|
||||
- @uppy/provider-views@5.0.2
|
||||
- @uppy/utils@7.0.2
|
||||
|
||||
## 5.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- c5b51f6: ### Export maps for all packages
|
||||
|
||||
All packages now have export maps. This is a breaking change in two cases:
|
||||
|
||||
1. The css imports have changed from `@uppy[package]/dist/styles.min.css` to `@uppy[package]/css/styles.min.css`
|
||||
2. You were importing something that wasn't exported from the root, for instance `@uppy/core/lib/foo.js`. You can now only import things we explicitly exported.
|
||||
|
||||
#### Changed imports for `@uppy/react`, `@uppy/vue`, and `@uppy/svelte`
|
||||
|
||||
Some components, like Dashboard, require a peer dependency to work but since all components were exported from a single file you were forced to install all peer dependencies. Even if you never imported, for instance, the status bar component.
|
||||
|
||||
Every component that requires a peer dependency has now been moved to a subpath, such as `@uppy/react/dashboard`, so you only need to install the peer dependencies you need.
|
||||
|
||||
**Example for `@uppy/react`:**
|
||||
|
||||
**Before:**
|
||||
|
||||
```javascript
|
||||
import { Dashboard, StatusBar } from "@uppy/react";
|
||||
```
|
||||
|
||||
**Now:**
|
||||
|
||||
```javascript
|
||||
import Dashboard from "@uppy/react/dashboard";
|
||||
import StatusBar from "@uppy/react/status-bar";
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d301c01]
|
||||
- Updated dependencies [c5b51f6]
|
||||
- @uppy/utils@7.0.0
|
||||
- @uppy/companion-client@5.0.0
|
||||
- @uppy/provider-views@5.0.0
|
||||
- @uppy/core@5.0.0
|
||||
|
||||
## 4.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 1b1a9e3: Define "files" in package.json
|
||||
- Updated dependencies [1b1a9e3]
|
||||
- Updated dependencies [c66fd85]
|
||||
- @uppy/companion-client@4.5.2
|
||||
- @uppy/provider-views@4.5.2
|
||||
- @uppy/utils@6.2.2
|
||||
- @uppy/core@4.5.2
|
||||
|
||||
## 4.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 0c24c5a: Use TypeScript compiler instead of Babel
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [0c24c5a]
|
||||
- Updated dependencies [0c24c5a]
|
||||
- @uppy/core@4.5.0
|
||||
- @uppy/companion-client@4.5.0
|
||||
- @uppy/provider-views@4.5.0
|
||||
- @uppy/utils@6.2.0
|
||||
|
||||
## 4.2.3
|
||||
|
||||
Released: 2025-05-18
|
||||
Included in: Uppy v4.16.0
|
||||
|
||||
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
|
||||
|
||||
## 4.2.0
|
||||
|
||||
Released: 2025-01-06
|
||||
Included in: Uppy v4.11.0
|
||||
|
||||
- @uppy/angular,@uppy/audio,@uppy/aws-s3,@uppy/box,@uppy/companion-client,@uppy/compressor,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/drop-target,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/progress-bar,@uppy/provider-views,@uppy/react,@uppy/remote-sources,@uppy/screen-capture,@uppy/status-bar,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/vue,@uppy/webcam,@uppy/webdav,@uppy/xhr-upload,@uppy/zoom: Remove "paths" from all tsconfig's (Merlijn Vos / #5572)
|
||||
|
||||
## 4.1.2
|
||||
|
||||
Released: 2024-12-05
|
||||
Included in: Uppy v4.8.0
|
||||
|
||||
- @uppy/audio,@uppy/aws-s3,@uppy/box,@uppy/companion-client,@uppy/compressor,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/drop-target,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/progress-bar,@uppy/provider-views,@uppy/react,@uppy/remote-sources,@uppy/screen-capture,@uppy/status-bar,@uppy/store-default,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/vue,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: cleanup tsconfig (Mikael Finstad / #5520)
|
||||
|
||||
## 4.1.1
|
||||
|
||||
Released: 2024-10-31
|
||||
Included in: Uppy v4.6.0
|
||||
|
||||
- @uppy/aws-s3,@uppy/box,@uppy/companion-client,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/progress-bar,@uppy/provider-views,@uppy/react-native,@uppy/react,@uppy/redux-dev-tools,@uppy/screen-capture,@uppy/status-bar,@uppy/store-default,@uppy/store-redux,@uppy/svelte,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/vue,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: Fix links (Anthony Veaudry / #5492)
|
||||
|
||||
## 4.1.0
|
||||
|
||||
Released: 2024-08-29
|
||||
Included in: Uppy v4.3.0
|
||||
|
||||
- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433)
|
||||
|
||||
## 4.0.0-beta.1
|
||||
|
||||
Released: 2024-03-28
|
||||
Included in: Uppy v4.0.0-beta.1
|
||||
|
||||
- @uppy/instagram: refactor to TypeScript (Murderlon / #4979)
|
||||
|
||||
## 3.3.0
|
||||
|
||||
Released: 2024-03-27
|
||||
Included in: Uppy v3.24.0
|
||||
|
||||
- @uppy/instagram: refactor to TypeScript (Murderlon / #4979)
|
||||
|
||||
## 3.0.1
|
||||
|
||||
Released: 2022-09-25
|
||||
Included in: Uppy v3.1.0
|
||||
|
||||
- @uppy/audio,@uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/box,@uppy/companion-client,@uppy/companion,@uppy/compressor,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/drop-target,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/progress-bar,@uppy/provider-views,@uppy/react,@uppy/redux-dev-tools,@uppy/remote-sources,@uppy/screen-capture,@uppy/status-bar,@uppy/store-default,@uppy/store-redux,@uppy/svelte,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/vue,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: add missing entries to changelog for individual packages (Antoine du Hamel / #4092)
|
||||
|
||||
## 3.0.0
|
||||
|
||||
Released: 2022-08-22
|
||||
Included in: Uppy v3.0.0
|
||||
|
||||
- Switch to ESM
|
||||
|
||||
## 2.1.1
|
||||
|
||||
Released: 2022-05-30
|
||||
Included in: Uppy v2.11.0
|
||||
|
||||
- @uppy/angular,@uppy/audio,@uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/progress-bar,@uppy/react,@uppy/redux-dev-tools,@uppy/robodog,@uppy/screen-capture,@uppy/status-bar,@uppy/store-default,@uppy/store-redux,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/vue,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: doc: update bundler recommendation (Antoine du Hamel / #3763)
|
||||
|
||||
## 2.1.0
|
||||
|
||||
Released: 2022-05-14
|
||||
Included in: Uppy v2.10.0
|
||||
|
||||
- @uppy/instagram: refactor to ESM (Antoine du Hamel / #3696)
|
||||
|
||||
## 2.0.5
|
||||
|
||||
Released: 2021-12-07
|
||||
Included in: Uppy v2.3.0
|
||||
|
||||
- @uppy/aws-s3,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive,@uppy/image-editor,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/screen-capture,@uppy/status-bar,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/url,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: Refactor locale scripts & generate types and docs (Merlijn Vos / #3276)
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Transloadit
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# @uppy/instagram
|
||||
|
||||
<img src="https://uppy.io/img/logo.svg" width="120" alt="Uppy logo: a smiling puppy above a pink upwards arrow" align="right">
|
||||
|
||||
[](https://www.npmjs.com/package/@uppy/instagram)
|
||||

|
||||

|
||||

|
||||
|
||||
The Instagram plugin lets users import photos from their Instagram account.
|
||||
|
||||
A [Companion](https://uppy.io/docs/companion) instance is required for the
|
||||
Instagram plugin to work. Companion handles authentication with Instagram,
|
||||
downloads the pictures and videos, and uploads them to the destination. This
|
||||
saves the user bandwidth, especially helpful if they are on a mobile connection.
|
||||
|
||||
Uppy is being developed by the folks at [Transloadit](https://transloadit.com),
|
||||
a versatile file encoding service.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
import Uppy from '@uppy/core'
|
||||
import Instagram from '@uppy/instagram'
|
||||
|
||||
const uppy = new Uppy()
|
||||
uppy.use(Instagram, {})
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install @uppy/instagram
|
||||
```
|
||||
|
||||
Alternatively, you can also use this plugin in a pre-built bundle from
|
||||
Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the
|
||||
global `window.Uppy` object. See the
|
||||
[main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for this plugin can be found on the
|
||||
[Uppy website](https://uppy.io/docs/instagram).
|
||||
|
||||
## License
|
||||
|
||||
[The MIT License](./LICENSE).
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"name": "@uppy/instagram",
|
||||
"description": "Import photos and videos from Instagram, into Uppy.",
|
||||
"version": "5.1.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "tsc --build tsconfig.build.json",
|
||||
"typecheck": "tsc --build"
|
||||
},
|
||||
"keywords": [
|
||||
"file uploader",
|
||||
"uppy",
|
||||
"uppy-plugin",
|
||||
"instagram",
|
||||
"provider",
|
||||
"photos",
|
||||
"videos"
|
||||
],
|
||||
"homepage": "https://uppy.io",
|
||||
"bugs": {
|
||||
"url": "https://github.com/transloadit/uppy/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transloadit/uppy.git"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"lib",
|
||||
"dist",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"exports": {
|
||||
".": "./lib/index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uppy/companion-client": "workspace:^",
|
||||
"@uppy/provider-views": "workspace:^",
|
||||
"@uppy/utils": "workspace:^",
|
||||
"preact": "^10.26.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@uppy/core": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@uppy/core": "workspace:^",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
import {
|
||||
type CompanionPluginOptions,
|
||||
getAllowedHosts,
|
||||
Provider,
|
||||
tokenStorage,
|
||||
} from '@uppy/companion-client'
|
||||
import type {
|
||||
AsyncStore,
|
||||
Body,
|
||||
Meta,
|
||||
UnknownProviderPlugin,
|
||||
UnknownProviderPluginState,
|
||||
UppyFile,
|
||||
} from '@uppy/core'
|
||||
import { UIPlugin, type Uppy } from '@uppy/core'
|
||||
import { ProviderViews } from '@uppy/provider-views'
|
||||
|
||||
import type { LocaleStrings } from '@uppy/utils'
|
||||
// biome-ignore lint/style/useImportType: h is not a type
|
||||
import { type ComponentChild, h } from 'preact'
|
||||
import packageJson from '../package.json' with { type: 'json' }
|
||||
import locale from './locale.js'
|
||||
|
||||
declare module '@uppy/core' {
|
||||
export interface PluginTypeRegistry<M extends Meta, B extends Body> {
|
||||
Instagram: Instagram<M, B>
|
||||
}
|
||||
}
|
||||
|
||||
export type InstagramOptions = CompanionPluginOptions & {
|
||||
locale?: LocaleStrings<typeof locale>
|
||||
}
|
||||
|
||||
export default class Instagram<M extends Meta, B extends Body>
|
||||
extends UIPlugin<InstagramOptions, M, B, UnknownProviderPluginState>
|
||||
implements UnknownProviderPlugin<M, B>
|
||||
{
|
||||
static VERSION = packageJson.version
|
||||
|
||||
icon: () => h.JSX.Element
|
||||
|
||||
provider: Provider<M, B>
|
||||
|
||||
view!: ProviderViews<M, B>
|
||||
|
||||
storage: AsyncStore
|
||||
|
||||
files: UppyFile<M, B>[]
|
||||
|
||||
rootFolderId: string | null = 'recent'
|
||||
|
||||
constructor(uppy: Uppy<M, B>, opts: InstagramOptions) {
|
||||
super(uppy, opts)
|
||||
this.type = 'acquirer'
|
||||
this.files = []
|
||||
this.storage = this.opts.storage || tokenStorage
|
||||
this.id = this.opts.id || 'Instagram'
|
||||
this.icon = () => (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<defs>
|
||||
<path
|
||||
d="M16.825 5l.483-.001.799.002c1.168.005 1.598.021 2.407.057 1.17.05 1.97.235 2.67.506.725.28 1.34.655 1.951 1.265.613.61.99 1.223 1.273 1.946.273.7.46 1.498.516 2.67l.025.552.008.205c.029.748.037 1.51.042 3.777l.001.846v.703l-.001.398a50.82 50.82 0 01-.058 2.588c-.05 1.17-.235 1.97-.506 2.67a5.394 5.394 0 01-1.265 1.951c-.61.613-1.222.99-1.946 1.273-.699.273-1.498.46-2.668.516-.243.012-.451.022-.656.03l-.204.007c-.719.026-1.512.034-3.676.038l-.847.001h-1.1a50.279 50.279 0 01-2.587-.059c-1.171-.05-1.971-.235-2.671-.506a5.394 5.394 0 01-1.951-1.265 5.385 5.385 0 01-1.272-1.946c-.274-.699-.46-1.498-.517-2.668a88.15 88.15 0 01-.03-.656l-.007-.205c-.026-.718-.034-1.512-.038-3.674v-2.129c.006-1.168.022-1.597.058-2.406.051-1.171.235-1.971.506-2.672a5.39 5.39 0 011.265-1.95 5.381 5.381 0 011.946-1.272c.699-.274 1.498-.462 2.669-.517l.656-.03.204-.007c.718-.026 1.511-.034 3.674-.038zm.678 1.981h-1.226l-.295.001c-2.307.005-3.016.013-3.777.043l-.21.009-.457.02c-1.072.052-1.654.232-2.042.383-.513.2-.879.44-1.263.825a3.413 3.413 0 00-.82 1.267c-.15.388-.33.97-.375 2.043a48.89 48.89 0 00-.056 2.482v.398 1.565c.006 2.937.018 3.285.073 4.444.05 1.073.231 1.654.382 2.043.2.512.44.878.825 1.263.386.383.753.621 1.267.82.388.15.97.328 2.043.374.207.01.388.017.563.024l.208.007a63.28 63.28 0 002.109.026h1.564c2.938-.006 3.286-.019 4.446-.073 1.071-.051 1.654-.232 2.04-.383.514-.2.88-.44 1.264-.825.384-.386.622-.753.82-1.266.15-.389.328-.971.375-2.044.039-.88.054-1.292.057-2.723v-1.15-.572c-.006-2.936-.019-3.284-.074-4.445-.05-1.071-.23-1.654-.382-2.04-.2-.515-.44-.88-.825-1.264a3.405 3.405 0 00-1.267-.82c-.388-.15-.97-.328-2.042-.375a48.987 48.987 0 00-2.535-.056zm-1.515 3.37a5.65 5.65 0 11.021 11.299 5.65 5.65 0 01-.02-11.3zm.004 1.982a3.667 3.667 0 10.015 7.334 3.667 3.667 0 00-.015-7.334zm5.865-3.536a1.32 1.32 0 11.005 2.64 1.32 1.32 0 01-.005-2.64z"
|
||||
id="a"
|
||||
/>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<mask id="b" fill="#fff">
|
||||
<use xlinkHref="#a" />
|
||||
</mask>
|
||||
<image
|
||||
mask="url(#b)"
|
||||
x="4"
|
||||
y="4"
|
||||
width="24"
|
||||
height="24"
|
||||
xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALKADAAQAAAABAAAALAAAAAD8buejAAALZklEQVRYCVWZC2LbNhAFCRKykvP0bD1506SxRKIzbwHJoU3jv5h9WICU3P7+6zlG2zZvr8s/rW1tN7U0rMll8aDYufdzbLfc1JHmpv3jpPy8tsO+3O2s/O6YMSjTl/qdCds4mIIG60m8vdq2Z+phm2V4vAb9+o7BbZeuoM0NyYazvTvbvlN1MGjHUAesZ/IWWOsCeF0BOwAK4ITR0WYd/QKHEPv2DEymmorZtiubjOHEMYEzXmC9GMxu+95Kz+kuwxjDBKb8iUoCAdqZoAeyALreW6ZNx9Y4Jz8cLwjTZOEoR+HU05k2RzgP2iafGgfZiEdZbEr94zpX/xkPtDtGAxF+LRcgTsp9CAZg0rnEnXmPqFshY5vLnVWxLXO/bah2sZQgBZppGSe8NbjNPN5kc/WbIYEn8U+jXCOezT4zfgS1eoVEhceVeK74Fe4N6CoYEoLWykzHsd+GMAUqdTTVvvqT1uWqB3lVCLb12/ORAe8/5Zu9mp7lqoEFUCAFDIxqz7i1bq2AY1U9jqq2QK/7DYl+1AeZlAFcEc+U/jkRUqsvCHQ/nyGvjrOl6EuZWRWVGCKUMCkntQ5o+u2AZ3OxakbTcoBZnY0xhgGCUM4Kp1xtBTnBnXM5ASRms/Fs7d9Op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
/>
|
||||
</g>
|
||||
</svg>
|
||||
)
|
||||
|
||||
this.defaultLocale = locale
|
||||
|
||||
this.i18nInit()
|
||||
this.title = this.i18n('pluginNameInstagram')
|
||||
|
||||
this.opts.companionAllowedHosts = getAllowedHosts(
|
||||
this.opts.companionAllowedHosts,
|
||||
this.opts.companionUrl,
|
||||
)
|
||||
this.provider = new Provider(uppy, {
|
||||
companionUrl: this.opts.companionUrl,
|
||||
companionHeaders: this.opts.companionHeaders,
|
||||
companionKeysParams: this.opts.companionKeysParams,
|
||||
companionCookiesRule: this.opts.companionCookiesRule,
|
||||
provider: 'instagram',
|
||||
pluginId: this.id,
|
||||
supportsRefreshToken: false,
|
||||
})
|
||||
|
||||
this.render = this.render.bind(this)
|
||||
}
|
||||
|
||||
install(): void {
|
||||
this.view = new ProviderViews(this, {
|
||||
provider: this.provider,
|
||||
viewType: 'grid',
|
||||
showTitles: false,
|
||||
showFilter: false,
|
||||
showBreadcrumbs: false,
|
||||
})
|
||||
|
||||
const { target } = this.opts
|
||||
if (target) {
|
||||
this.mount(target, this)
|
||||
}
|
||||
}
|
||||
|
||||
uninstall(): void {
|
||||
this.view.tearDown()
|
||||
this.unmount()
|
||||
}
|
||||
|
||||
render(state: unknown): ComponentChild {
|
||||
return this.view.render(state)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export type { InstagramOptions } from './Instagram.js'
|
||||
export { default } from './Instagram.js'
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export default {
|
||||
strings: {
|
||||
pluginNameInstagram: 'Instagram',
|
||||
},
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.shared",
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["./src/**/*.*"],
|
||||
"exclude": ["./src/**/*.test.ts"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../companion-client/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../provider-views/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../utils/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../core/tsconfig.build.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.shared",
|
||||
"compilerOptions": {
|
||||
"emitDeclarationOnly": false,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["./package.json", "./src/**/*.*"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../companion-client/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../provider-views/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../utils/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../core/tsconfig.build.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build", "@uppy/core#build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +134,6 @@ ca_ES.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: 'Desenvolupat per %{uppy}',
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ de_DE.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: 'Powered by %{uppy}',
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ en_US.strings = {
|
|||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameGoogleDrivePicker: 'Google Drive',
|
||||
pluginNameGooglePhotosPicker: 'Google Photos',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Screencast',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ es_ES.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: 'Desarrollado por %{uppy}',
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ fa_IR.strings = {
|
|||
pluginNameDropbox: 'دراپ باکس',
|
||||
pluginNameFacebook: 'فیس بوک',
|
||||
pluginNameGoogleDrive: 'درایو گوگل',
|
||||
pluginNameInstagram: 'اینستاگرام',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'بزرگنمایی',
|
||||
poweredBy: 'قدرت گرفته از %{uppy}',
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ ms_MY.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Screencast',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ nl_NL.strings = {
|
|||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameGoogleDrivePicker: 'Google Drive',
|
||||
pluginNameGooglePhotosPicker: 'Google Photos',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Screencast',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ pl_PL.strings = {
|
|||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameGoogleDrivePicker: 'Google Drive',
|
||||
pluginNameGooglePhotosPicker: 'Google Photos',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Zrzut ekranu',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ pt_BR.strings = {
|
|||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameGoogleDrivePicker: 'Google Drive',
|
||||
pluginNameGooglePhotosPicker: 'Google Photos',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Screencast',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ sv_SE.strings = {
|
|||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameGoogleDrivePicker: 'Google Drive',
|
||||
pluginNameGooglePhotosPicker: 'Google Foton',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameScreenCapture: 'Skärminspelning',
|
||||
pluginNameUnsplash: 'Unsplash',
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ uk_UA.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: 'Працює на %{uppy}',
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ uz_UZ.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: '%{uppy} tomonidan quvvatlanadi',
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ vi_VN.strings = {
|
|||
pluginNameDropbox: 'Dropbox',
|
||||
pluginNameFacebook: 'Facebook',
|
||||
pluginNameGoogleDrive: 'Google Drive',
|
||||
pluginNameInstagram: 'Instagram',
|
||||
pluginNameOneDrive: 'OneDrive',
|
||||
pluginNameZoom: 'Zoom',
|
||||
poweredBy: 'Được cung cấp bởi %{uppy}',
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
"@uppy/dropbox#build",
|
||||
"@uppy/webdav#build",
|
||||
"@uppy/unsplash#build",
|
||||
"@uppy/webcam#build",
|
||||
"@uppy/instagram#build"
|
||||
"@uppy/webcam#build"
|
||||
],
|
||||
"inputs": [
|
||||
"script/**/*.{js,ts,jsx,tsx}",
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ const defaultOptions = {
|
|||
|
||||
/**
|
||||
* SearchProviderView, used for Unsplash and future image search providers.
|
||||
* Extends generic View, shared with regular providers like Google Drive and Instagram.
|
||||
* Extends generic View, shared with regular providers like Google Drive.
|
||||
*/
|
||||
export default class SearchProviderView<M extends Meta, B extends Body> {
|
||||
static VERSION = packageJson.version
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@uppy/remote-sources",
|
||||
"description": "Uppy plugin that includes all remote sources that Uppy+Companion offer, like Instagram, Google Drive, Dropox, Box, Unsplash, Url etc",
|
||||
"description": "Uppy plugin that includes all remote sources that Uppy+Companion offer, like Google Drive, Dropbox, Box, Unsplash, Url etc",
|
||||
"version": "3.1.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
},
|
||||
"keywords": [
|
||||
"file uploader",
|
||||
"instagram",
|
||||
"google-drive",
|
||||
"facebook",
|
||||
"dropbox",
|
||||
|
|
@ -46,7 +45,6 @@
|
|||
"@uppy/dropbox": "workspace:^",
|
||||
"@uppy/facebook": "workspace:^",
|
||||
"@uppy/google-drive": "workspace:^",
|
||||
"@uppy/instagram": "workspace:^",
|
||||
"@uppy/onedrive": "workspace:^",
|
||||
"@uppy/unsplash": "workspace:^",
|
||||
"@uppy/url": "workspace:^",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ describe('RemoteSources', () => {
|
|||
sources: ['Webcam'],
|
||||
})
|
||||
}).toThrow(
|
||||
'Invalid plugin: "Webcam" is not one of: Box, Dropbox, Facebook, GoogleDrive, Instagram, OneDrive, Unsplash, Url, or Zoom.',
|
||||
'Invalid plugin: "Webcam" is not one of: Box, Dropbox, Facebook, GoogleDrive, OneDrive, Unsplash, Url, or Zoom.',
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import { BasePlugin } from '@uppy/core'
|
|||
import Dropbox from '@uppy/dropbox'
|
||||
import Facebook from '@uppy/facebook'
|
||||
import GoogleDrive from '@uppy/google-drive'
|
||||
import Instagram from '@uppy/instagram'
|
||||
import OneDrive from '@uppy/onedrive'
|
||||
import Unsplash from '@uppy/unsplash'
|
||||
import Url from '@uppy/url'
|
||||
|
|
@ -25,7 +24,6 @@ export const availablePlugins = {
|
|||
Dropbox,
|
||||
Facebook,
|
||||
GoogleDrive,
|
||||
Instagram,
|
||||
OneDrive,
|
||||
Unsplash,
|
||||
Url,
|
||||
|
|
@ -37,7 +35,6 @@ export type AvailablePluginsKeys =
|
|||
| 'Dropbox'
|
||||
| 'Facebook'
|
||||
| 'GoogleDrive'
|
||||
| 'Instagram'
|
||||
| 'OneDrive'
|
||||
| 'Unsplash'
|
||||
| 'Url'
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@
|
|||
{
|
||||
"path": "../google-drive/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../instagram/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../onedrive/tsconfig.build.json"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@
|
|||
{
|
||||
"path": "../google-drive/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../instagram/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../onedrive/tsconfig.build.json"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -140,6 +140,13 @@ class TransloaditAssembly extends Emitter {
|
|||
|
||||
this.#sse.addEventListener('assembly_execution_progress', (e) => {
|
||||
const details = JSON.parse(e.data)
|
||||
// setting combined execution progress of the assembly
|
||||
if (typeof details.progress_combined === 'number') {
|
||||
this.status = {
|
||||
...this.status,
|
||||
progress_combined: details.progress_combined,
|
||||
}
|
||||
}
|
||||
this.emit('execution-progress', details)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,15 @@ describe('Transloadit', () => {
|
|||
},
|
||||
})
|
||||
|
||||
// Plugin state should start empty; track every distinct `ok` that lands in
|
||||
// it so we can verify the assembly lifecycle is reflected.
|
||||
expect(uppy.getState().plugins.Transloadit.assemblyStatus).toBeUndefined()
|
||||
const okHistory = []
|
||||
const unsubscribe = uppy.store.subscribe((_prev, next) => {
|
||||
const ok = next.plugins.Transloadit.assemblyStatus?.ok
|
||||
if (ok && ok !== okHistory.at(-1)) okHistory.push(ok)
|
||||
})
|
||||
|
||||
uppy.addFile({
|
||||
source: 'test',
|
||||
name: 'cat.jpg',
|
||||
|
|
@ -228,12 +237,22 @@ describe('Transloadit', () => {
|
|||
uppy.resumeAll()
|
||||
|
||||
await uploadPromise
|
||||
unsubscribe()
|
||||
|
||||
expect(successSpy).toHaveBeenCalled()
|
||||
|
||||
// Should be reset to true after upload completes
|
||||
expect(uppy.getState().allowNewUpload).toBe(true)
|
||||
|
||||
// The createAssembly mock returned ASSEMBLY_EXECUTING and the assembly
|
||||
// setter forwarded that status into plugin state during the upload.
|
||||
expect(okHistory).toContain('ASSEMBLY_EXECUTING')
|
||||
// `assemblyStatus` is the live slot — it clears when `this.assembly`
|
||||
// becomes undefined at the end of `#afterUpload`. `lastAssembly` is
|
||||
// intentionally not populated here because no terminal event fires in
|
||||
// this mocked flow (the server keeps returning ASSEMBLY_EXECUTING).
|
||||
expect(uppy.getState().plugins.Transloadit.assemblyStatus).toBeUndefined()
|
||||
|
||||
server.close()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ import AssemblyWatcher from './AssemblyWatcher.js'
|
|||
import Client, { type AssemblyError } from './Client.js'
|
||||
import locale from './locale.js'
|
||||
|
||||
export type AssemblyResponse = AssemblyStatus
|
||||
export type AssemblyResponse = AssemblyStatus & {
|
||||
progress_combined?: number
|
||||
}
|
||||
export type AssemblyFile = AssemblyStatusUpload
|
||||
export type AssemblyResult = AssemblyStatusResult & { localId: string | null }
|
||||
export type AssemblyParameters = AssemblyInstructionsInput
|
||||
|
|
@ -79,6 +81,19 @@ type TransloaditState = {
|
|||
string,
|
||||
{ assembly: string; id: string; uploadedFile: AssemblyFile }
|
||||
>
|
||||
/**
|
||||
* Live status of the currently-active assembly. Tracks every status
|
||||
* transition (UPLOADING → EXECUTING → ...). Cleared automatically when
|
||||
* `this.assembly = undefined` (no live assembly).
|
||||
*/
|
||||
assemblyStatus: AssemblyResponse | undefined
|
||||
/**
|
||||
* Snapshot of the most recent non-null status seen. Persists across the
|
||||
* gap between uploads so the UI can keep showing "your last upload's
|
||||
* result" after `assemblyStatus` clears. Overwritten by the next
|
||||
* status update routed through `#handleAssemblyStatusUpdate`.
|
||||
*/
|
||||
lastAssemblyStatus: AssemblyResponse | undefined
|
||||
results: Array<{
|
||||
result: AssemblyResult
|
||||
stepName: string
|
||||
|
|
@ -306,7 +321,6 @@ export default class Transloadit<
|
|||
addPluginVersion('GoogleDrive', 'uppy-google-drive')
|
||||
addPluginVersion('GoogleDrivePicker', 'uppy-google-drive-picker')
|
||||
addPluginVersion('GooglePhotosPicker', 'uppy-google-photos-picker')
|
||||
addPluginVersion('Instagram', 'uppy-instagram')
|
||||
addPluginVersion('OneDrive', 'uppy-onedrive')
|
||||
addPluginVersion('Zoom', 'uppy-zoom')
|
||||
addPluginVersion('Url', 'uppy-url')
|
||||
|
|
@ -499,11 +513,20 @@ export default class Transloadit<
|
|||
}
|
||||
|
||||
/**
|
||||
* Allows Golden Retriever plugin to serialize the Assembly status so we can restore it later
|
||||
* Mirrors the live Assembly status into plugin state and lets Golden
|
||||
* Retriever serialize it for restore. `assemblyStatus` is written
|
||||
* unconditionally — when `this.assembly = undefined`, `assemblyResponse`
|
||||
* is undefined and `assemblyStatus` clears too. `lastAssemblyStatus`
|
||||
* captures the most recent non-null status so the UI can keep displaying
|
||||
* the previous run's result after `assemblyStatus` clears.
|
||||
*/
|
||||
#handleAssemblyStatusUpdate = (
|
||||
assemblyResponse: AssemblyResponse | undefined,
|
||||
) => {
|
||||
if (assemblyResponse != null) {
|
||||
this.setPluginState({ lastAssemblyStatus: assemblyResponse })
|
||||
}
|
||||
this.setPluginState({ assemblyStatus: assemblyResponse })
|
||||
this.uppy.emit('restore:plugin-data-changed', {
|
||||
[this.id]: assemblyResponse ? { assemblyResponse } : undefined,
|
||||
})
|
||||
|
|
@ -650,6 +673,9 @@ export default class Transloadit<
|
|||
this.uppy.log(err)
|
||||
}
|
||||
}
|
||||
// `assemblyStatus` is cleared automatically when `this.assembly = undefined`
|
||||
// (via `#cancelAssembly` above, or by `#afterUpload`'s finally block).
|
||||
|
||||
// Reset allowNewUpload when upload is cancelled
|
||||
this.uppy.setState({ allowNewUpload: true })
|
||||
}
|
||||
|
|
@ -1006,6 +1032,8 @@ export default class Transloadit<
|
|||
this.uppy.on('restored', this.#onRestored)
|
||||
|
||||
this.setPluginState({
|
||||
assemblyStatus: undefined,
|
||||
lastAssemblyStatus: undefined,
|
||||
// Contains file data from Transloadit, indexed by their Transloadit-assigned ID.
|
||||
files: {},
|
||||
// Contains result data from Transloadit.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "uppy",
|
||||
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
|
||||
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox, Google Drive, S3 and more :dog:",
|
||||
"version": "5.2.4",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
|
|
@ -55,7 +55,6 @@
|
|||
"@uppy/google-photos-picker": "workspace:*",
|
||||
"@uppy/image-editor": "workspace:*",
|
||||
"@uppy/image-generator": "workspace:*",
|
||||
"@uppy/instagram": "workspace:*",
|
||||
"@uppy/locales": "workspace:*",
|
||||
"@uppy/onedrive": "workspace:*",
|
||||
"@uppy/provider-views": "workspace:*",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ export { default as GoogleDrive } from '@uppy/google-drive'
|
|||
export { default as GoogleDrivePicker } from '@uppy/google-drive-picker'
|
||||
export { default as GooglePhotosPicker } from '@uppy/google-photos-picker'
|
||||
export { default as ImageEditor } from '@uppy/image-editor'
|
||||
export { default as Instagram } from '@uppy/instagram'
|
||||
export { default as OneDrive } from '@uppy/onedrive'
|
||||
export { default as RemoteSources } from '@uppy/remote-sources'
|
||||
export { default as ScreenCapture } from '@uppy/screen-capture'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ export type { FormOptions } from '@uppy/form'
|
|||
export type { GoldenRetrieverOptions } from '@uppy/golden-retriever'
|
||||
export type { GoogleDriveOptions } from '@uppy/google-drive'
|
||||
export type { ImageEditorOptions } from '@uppy/image-editor'
|
||||
export type { InstagramOptions } from '@uppy/instagram'
|
||||
export type { OneDriveOptions } from '@uppy/onedrive'
|
||||
export type { RemoteSourcesOptions } from '@uppy/remote-sources'
|
||||
export type { ScreenCaptureOptions } from '@uppy/screen-capture'
|
||||
|
|
|
|||
|
|
@ -55,9 +55,6 @@
|
|||
{
|
||||
"path": "../@uppy/image-editor/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../@uppy/instagram/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../@uppy/onedrive/tsconfig.build.json"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -54,9 +54,6 @@
|
|||
{
|
||||
"path": "../@uppy/image-editor/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../@uppy/instagram/tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "../@uppy/onedrive/tsconfig.build.json"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ export default () => {
|
|||
companionAllowedHosts,
|
||||
...getCompanionKeysParams('GOOGLE_DRIVE'),
|
||||
})
|
||||
// .use(Instagram, { target: Dashboard, companionUrl: COMPANION_URL, companionAllowedHosts })
|
||||
// .use(Dropbox, { target: Dashboard, companionUrl: COMPANION_URL, companionAllowedHosts })
|
||||
// .use(Box, { target: Dashboard, companionUrl: COMPANION_URL, companionAllowedHosts })
|
||||
// .use(Facebook, { target: Dashboard, companionUrl: COMPANION_URL, companionAllowedHosts })
|
||||
|
|
@ -150,7 +149,6 @@ export default () => {
|
|||
'Box',
|
||||
'Dropbox',
|
||||
'Facebook',
|
||||
'Instagram',
|
||||
'OneDrive',
|
||||
'Unsplash',
|
||||
'Zoom',
|
||||
|
|
|
|||
17
yarn.lock
17
yarn.lock
|
|
@ -10070,21 +10070,6 @@ __metadata:
|
|||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@uppy/instagram@workspace:*, @uppy/instagram@workspace:^, @uppy/instagram@workspace:packages/@uppy/instagram":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@uppy/instagram@workspace:packages/@uppy/instagram"
|
||||
dependencies:
|
||||
"@uppy/companion-client": "workspace:^"
|
||||
"@uppy/core": "workspace:^"
|
||||
"@uppy/provider-views": "workspace:^"
|
||||
"@uppy/utils": "workspace:^"
|
||||
preact: "npm:^10.26.10"
|
||||
typescript: "npm:^5.8.3"
|
||||
peerDependencies:
|
||||
"@uppy/core": "workspace:^"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@uppy/locales@workspace:*, @uppy/locales@workspace:packages/@uppy/locales":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@uppy/locales@workspace:packages/@uppy/locales"
|
||||
|
|
@ -10185,7 +10170,6 @@ __metadata:
|
|||
"@uppy/dropbox": "workspace:^"
|
||||
"@uppy/facebook": "workspace:^"
|
||||
"@uppy/google-drive": "workspace:^"
|
||||
"@uppy/instagram": "workspace:^"
|
||||
"@uppy/onedrive": "workspace:^"
|
||||
"@uppy/unsplash": "workspace:^"
|
||||
"@uppy/url": "workspace:^"
|
||||
|
|
@ -23245,7 +23229,6 @@ __metadata:
|
|||
"@uppy/google-photos-picker": "workspace:*"
|
||||
"@uppy/image-editor": "workspace:*"
|
||||
"@uppy/image-generator": "workspace:*"
|
||||
"@uppy/instagram": "workspace:*"
|
||||
"@uppy/locales": "workspace:*"
|
||||
"@uppy/onedrive": "workspace:*"
|
||||
"@uppy/provider-views": "workspace:*"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue