Skip to content

Commit

Permalink
Merge branch 'main' into get-socket-host
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon authored Feb 3, 2025
2 parents 025f4ee + 3efe61b commit 35f3ca5
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/companion-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build and push
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
push: true
context: .
Expand All @@ -81,6 +81,10 @@ jobs:
- name: Alter dockerfile
run: |
sed -i 's/^EXPOSE 3020$/EXPOSE $PORT/g' Dockerfile
# https://github.com/AkhileshNS/heroku-deploy/issues/188
- name: Install Heroku CLI
run: |
curl https://cli-assets.heroku.com/install.sh | sh
- name: Deploy to heroku
uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 # v3.13.15
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build and push
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
push: true
context: .
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/core/src/Uppy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ export class Uppy<

store: NonNullableUppyOptions<M, B>['store']

// Warning: do not use this from a plugin, as it will cause the plugins' translations to be missing
i18n!: I18n

i18nArray!: Translator['translateArray']
Expand Down
3 changes: 2 additions & 1 deletion packages/@uppy/google-drive-picker/src/GoogleDrivePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class GoogleDrivePicker<M extends Meta, B extends Body>

this.defaultLocale = locale
this.i18nInit()
this.title = this.i18n('pluginNameGoogleDrive')
this.title = this.i18n('pluginNameGoogleDrivePicker')

const client = new RequestClient(uppy, {
pluginId: this.id,
Expand Down Expand Up @@ -103,6 +103,7 @@ export default class GoogleDrivePicker<M extends Meta, B extends Body>
storage={this.storage}
pickerType="drive"
uppy={this.uppy}
i18n={this.i18n}
clientId={this.opts.clientId}
apiKey={this.opts.apiKey}
appId={this.opts.appId}
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/google-drive-picker/src/locale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
strings: {
pluginNameGoogleDrive: 'Google Drive',
pluginNameGoogleDrivePicker: 'Google Drive',
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class GooglePhotosPicker<M extends Meta, B extends Body>

this.defaultLocale = locale
this.i18nInit()
this.title = this.i18n('pluginNameGooglePhotos')
this.title = this.i18n('pluginNameGooglePhotosPicker')

const client = new RequestClient(uppy, {
pluginId: this.id,
Expand Down Expand Up @@ -101,6 +101,7 @@ export default class GooglePhotosPicker<M extends Meta, B extends Body>
storage={this.storage}
pickerType="photos"
uppy={this.uppy}
i18n={this.i18n}
clientId={this.opts.clientId}
onFilesPicked={this.handleFilesPicked}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/google-photos-picker/src/locale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
strings: {
pluginNameGooglePhotos: 'Google Photos',
pluginNameGooglePhotosPicker: 'Google Photos',
},
}
2 changes: 2 additions & 0 deletions packages/@uppy/locales/src/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ en_US.strings = {
pluginNameFacebook: 'Facebook',
pluginNameGoogleDrive: 'Google Drive',
pluginNameGooglePhotos: 'Google Photos',
pluginNameGoogleDrivePicker: 'Google Drive',
pluginNameGooglePhotosPicker: 'Google Photos',
pluginNameInstagram: 'Instagram',
pluginNameOneDrive: 'OneDrive',
pluginNameScreenCapture: 'Screencast',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks'

import type { Uppy, AsyncStore } from '@uppy/core'

import type { I18n } from '@uppy/utils/lib/Translator'

import {
authorize,
ensureScriptsInjected,
Expand Down Expand Up @@ -44,6 +46,7 @@ function useStore(

export type GooglePickerViewProps = {
uppy: Uppy<any, any>
i18n: I18n
clientId: string
onFilesPicked: (files: PickedItem[], accessToken: string) => void
storage: AsyncStore
Expand All @@ -62,6 +65,7 @@ export type GooglePickerViewProps = {

export default function GooglePickerView({
uppy,
i18n,
clientId,
onFilesPicked,
pickerType,
Expand Down Expand Up @@ -212,20 +216,20 @@ export default function GooglePickerView({
}, [accessToken, setAccessToken])

if (loading) {
return <div>{uppy.i18n('pleaseWait')}...</div>
return <div>{i18n('pleaseWait')}...</div>
}

if (accessToken == null) {
return (
<AuthView
pluginName={
pickerType === 'drive' ?
uppy.i18n('pluginNameGoogleDrive')
: uppy.i18n('pluginNameGooglePhotos')
i18n('pluginNameGoogleDrivePicker')
: i18n('pluginNameGooglePhotosPicker')
}
pluginIcon={pickerType === 'drive' ? GoogleDriveIcon : GooglePhotosIcon}
handleAuth={showPicker}
i18n={uppy.i18n}
i18n={i18n}
loading={loading}
/>
)
Expand All @@ -240,17 +244,15 @@ export default function GooglePickerView({
disabled={loading}
onClick={() => showPicker()}
>
{pickerType === 'drive' ?
uppy.i18n('pickFiles')
: uppy.i18n('pickPhotos')}
{pickerType === 'drive' ? i18n('pickFiles') : i18n('pickPhotos')}
</button>
<button
type="button"
className="uppy-u-reset uppy-c-btn"
disabled={loading}
onClick={handleLogoutClick}
>
{uppy.i18n('logOut')}
{i18n('logOut')}
</button>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,15 @@ async function resolvePickedPhotos({
return mediaItems.map(
({
id,
type,
// we want the original resolution, so we don't append any parameter to the baseUrl
// https://developers.google.com/photos/library/guides/access-media-items#base-urls
mediaFile: { mimeType, filename, baseUrl },
}) => ({
platform: 'photos' as const,
id,
mimeType,
url: baseUrl,
url: type === 'VIDEO' ? `${baseUrl}=dv` : baseUrl, // dv to download video
name: filename,
}),
)
Expand Down
8 changes: 6 additions & 2 deletions packages/@uppy/url/src/Url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,19 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<
protocollessUrl: string,
optionalMeta?: M,
): Promise<string | undefined> => {
// Do not process local files
if (protocollessUrl.startsWith('blob')) {
return undefined
}
const url = addProtocolToURL(protocollessUrl)
if (!checkIfCorrectURL(url)) {
this.uppy.log(`[URL] Incorrect URL entered: ${url}`)
this.uppy.info(this.i18n('enterCorrectUrl'), 'error', 4000)
return undefined
}

this.uppy.log(`[URL] Adding file from dropped/pasted url: ${url}`)

try {
const meta = await this.getMeta(url)

Expand Down Expand Up @@ -187,14 +193,12 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<

private handleRootDrop = (e: DragEvent) => {
forEachDroppedOrPastedUrl(e.dataTransfer!, 'drop', (url) => {
this.uppy.log(`[URL] Adding file from dropped url: ${url}`)
this.addFile(url)
})
}

private handleRootPaste = (e: ClipboardEvent) => {
forEachDroppedOrPastedUrl(e.clipboardData!, 'paste', (url) => {
this.uppy.log(`[URL] Adding file from pasted url: ${url}`)
this.addFile(url)
})
}
Expand Down

0 comments on commit 35f3ca5

Please sign in to comment.