feat(removebg): add remove-bg integration (#1406)
* feat(remove-bg): add remove-bg integration * feat(removebg): update name and icon * docs(removebg): update name and icon * docs: add remove.bg in available apps * docs(removebg): correct path --------- Co-authored-by: Ali BARIN <ali.barin53@gmail.com>
This commit is contained in:
1
packages/backend/src/apps/removebg/assets/favicon.svg
Normal file
1
packages/backend/src/apps/removebg/assets/favicon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="78.88" height="77" viewBox="0 0 78.88 77"><g transform="translate(-561 -471)"><g transform="translate(-479.103 381)"><g transform="translate(1040.104 94)"><g transform="translate(113.835 10.269)"><path d="M3640.414,2731.809l-5.131-3.025-31.2,18.389a3.848,3.848,0,0,1-3.906,0l-31.2-18.385-5.125,3.021a2.355,2.355,0,0,0,0,4.059l36.329,21.41a3.847,3.847,0,0,0,3.905,0l36.328-21.41a2.355,2.355,0,0,0,0-4.059Z" transform="translate(-3676.527 -2699.322)" fill="#bbc0c4"/><path d="M3640.414,2717.247l-36.328,21.41a3.847,3.847,0,0,1-3.905,0l-36.329-21.41a2.356,2.356,0,0,1,0-4.06l36.329-21.409a3.842,3.842,0,0,1,3.9,0l36.328,21.409a2.356,2.356,0,0,1,0,4.06Z" transform="translate(-3676.527 -2694.961)" fill="#55626d"/></g></g><rect width="420" height="77" transform="translate(1040.104 90)" fill="none"/></g></g></svg>
|
After Width: | Height: | Size: 857 B |
33
packages/backend/src/apps/removebg/auth/index.ts
Normal file
33
packages/backend/src/apps/removebg/auth/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'screenName',
|
||||
label: 'Screen Name',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description:
|
||||
'Screen name of your connection to be used on Automatisch UI.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'apiKey',
|
||||
label: 'API Key',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: 'API key of the remove.bg API service.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
@@ -0,0 +1,9 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -0,0 +1,12 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
await $.http.get('/account');
|
||||
|
||||
await $.auth.set({
|
||||
screenName: $.auth.data.screenName,
|
||||
apiKey: $.auth.data.apiKey,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
11
packages/backend/src/apps/removebg/common/add-auth-header.ts
Normal file
11
packages/backend/src/apps/removebg/common/add-auth-header.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data?.apiKey) {
|
||||
requestConfig.headers['X-API-Key'] = `${$.auth.data.apiKey}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
0
packages/backend/src/apps/removebg/index.d.ts
vendored
Normal file
0
packages/backend/src/apps/removebg/index.d.ts
vendored
Normal file
16
packages/backend/src/apps/removebg/index.ts
Normal file
16
packages/backend/src/apps/removebg/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Remove.bg',
|
||||
key: 'removebg',
|
||||
iconUrl: '{BASE_URL}/apps/removebg/assets/favicon.svg',
|
||||
authDocUrl: 'https://automatisch.io/docs/apps/removebg/connection',
|
||||
supportsConnections: true,
|
||||
baseUrl: 'https://www.remove.bg',
|
||||
apiBaseUrl: 'https://api.remove.bg/v1.0',
|
||||
primaryColor: '55636c',
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
});
|
Reference in New Issue
Block a user