Class: AWSClientPlugin
Extra-Helpers.AWSClientPlugin
AWSClientPlugin
Provides fetch
function that performs a fetch request with AWS v4 signing.
This is useful for connecting to AWS services like S3 directly from the client.
It also interfaces with the FileTransferPlugin to directly upload file when exported with the viewer or the plugin.
Note: Make sure to use keys with limited privileges and correct CORS settings.
All the keys will be stored in plain text in the vjson/glb when saved if serializeSettings
is set to true
Hierarchy
AViewerPlugin
<"fileUpload"
>↳
AWSClientPlugin
Properties
PluginType
▪ Static
Readonly
PluginType: "AWSClientPlugin1"
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:20
USE_PROXY
▪ Static
USE_PROXY: boolean
= false
Set to true to use a proxy for all requests.
This can be used to move the access credentials to the server side.
This is required for some services like cloudflare R2 that do not support CORS.
usage: AWSClientPlugin.USE_PROXY = true
, optionally set AWSClientPlugin.PROXY_URL
to a custom proxy.
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:81
PROXY_URL
▪ Static
PROXY_URL: string
= 'https://r2-s3-api.repalash.com/{path}'
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:82
uiConfig
• Optional
uiConfig: UiObjectConfig
<any
, string
>
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:21
enabled
• enabled: boolean
= true
Overrides
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:23
dependencies
• dependencies: typeof FileTransferPlugin
[]
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:28
accessKeyId
• accessKeyId: string
= ''
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:38
accessKeySecret
• accessKeySecret: string
= ''
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:44
endpointURL
• endpointURL: string
= ''
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:50
pathPrefix
• pathPrefix: string
= 'webgi'
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:56
serializeSettings
• serializeSettings: boolean
= false
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:62
serializeWithViewer
• Readonly
serializeWithViewer: false
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:117
fetchFunction
• fetchFunction: (input
: RequestInfo
, init?
: RequestInit
) => Promise
<Response
> = fetch
Type declaration
▸ (input
, init?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
input | RequestInfo |
init? | RequestInit |
Returns
Promise
<Response
>
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:148
_dirty
• Protected
_dirty: boolean
= false
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:23
_viewer
• Protected
Optional
_viewer: ViewerApp
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:27
Accessors
dirty
• get
dirty(): boolean
Returns
boolean
Inherited from
AViewerPlugin.dirty
Defined in
webgi/src/core/AViewerPlugin.ts:16
• set
dirty(value
): void
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Inherited from
AViewerPlugin.dirty
Defined in
webgi/src/core/AViewerPlugin.ts:20
viewer
• get
viewer(): undefined
| TViewer
Returns
undefined
| TViewer
Inherited from
AViewerPlugin.viewer
Defined in
webgi/src/core/AViewerPlugin.ts:29
connected
• get
connected(): boolean
Returns
boolean
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:109
client
• get
client(): undefined
| AwsClient
Returns
undefined
| AwsClient
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:112
Methods
onDispose
▸ onDispose(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:40
onRemove
▸ onRemove(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:44
fromJSON
▸ fromJSON(data
, meta?
): null
| AWSClientPlugin
| Promise
<null
| AWSClientPlugin
>
Parameters
Name | Type |
---|---|
data | any |
meta? | any |
Returns
null
| AWSClientPlugin
| Promise
<null
| AWSClientPlugin
>
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:56
exportState
▸ exportState(): any
Returns
any
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:68
importState
▸ importState(state
): Promise
<void
>
Parameters
Name | Type |
---|---|
state | any |
Returns
Promise
<void
>
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:71
storeState
▸ storeState(prefix?
, storage?
, data?
): void
Parameters
Name | Type |
---|---|
prefix? | string |
storage? | Storage |
data? | any |
Returns
void
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:78
loadState
▸ loadState(prefix?
, storage?
): Promise
<void
>
Parameters
Name | Type |
---|---|
prefix? | string |
storage? | Storage |
Returns
Promise
<void
>
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:88
toggleConnection
▸ toggleConnection(): void
Returns
void
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:67
connect
▸ connect(): void
Returns
void
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:84
refreshUi
▸ refreshUi(): void
Returns
void
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:97
disconnect
▸ disconnect(): void
Returns
void
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:101
toJSON
▸ toJSON(meta?
): any
Parameters
Name | Type |
---|---|
meta? | any |
Returns
any
Overrides
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:119
onAdded
▸ onAdded(viewer
): Promise
<void
>
Parameters
Name | Type |
---|---|
viewer | ViewerApp |
Returns
Promise
<void
>
Overrides
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:124
fetch
▸ fetch(input
, init
, onProgress?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
input | RequestInfo |
init | RequestInit |
onProgress? | (d : { state? : string ; progress? : number }) => void |
Returns
Promise
<Response
>
Defined in
webgi/src/extras/network/AWSClientPlugin.ts:149
_storeKey
▸ Protected
_storeKey(prefix?
): string
Parameters
Name | Type |
---|---|
prefix? | string |
Returns
string
Inherited from
Defined in
webgi/src/core/AViewerPlugin.ts:64
Constructors
constructor
• new AWSClientPlugin()