Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e6540b5b7e | ||
![]() |
ef5a09314e | ||
![]() |
ba52e298eb | ||
![]() |
b3c3998189 | ||
![]() |
782f9b5c04 | ||
![]() |
3079d8c605 | ||
![]() |
c5202d7b3e |
28
packages/backend/src/apps/libretranslate/assets/favicon.svg
Normal file
28
packages/backend/src/apps/libretranslate/assets/favicon.svg
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="187.04305" height="188.81523" viewBox="0 0 49.488472 49.957363" version="1.1" id="svg8">
|
||||||
|
<defs id="defs2">
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect835"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect835-7"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect874"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect923"/>
|
||||||
|
</defs>
|
||||||
|
<metadata id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
|
<dc:title/>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g id="layer1" transform="translate(-23.040803,-26.932047)">
|
||||||
|
<g id="g861" transform="translate(-42.114518,-17.993737)" style="fill:#000000">
|
||||||
|
<g aria-label="众" transform="matrix(4.3205134,0,0,4.3205134,-37.271798,-327.6536)" id="text833" style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect835);fill:#000000;fill-opacity:1;stroke:none">
|
||||||
|
<path d="m 34.996103,90.121035 -0.614947,0.759641 q -2.754346,-1.41593 -3.948067,-2.950715 -1.167884,1.617467 -3.7672,2.888703 L 26.0096,90.084861 q 3.457142,-1.601964 4.283963,-3.849882 l 0.878496,0.273884 q -0.175699,0.516763 -0.232543,0.604613 1.116207,1.596797 4.056587,3.007559 z m 0.165364,4.91958 -0.676959,0.645954 q -1.514115,-1.157549 -2.346102,-2.826692 -0.547769,1.550288 -2.268589,2.806021 l -0.676959,-0.625283 q 1.19889,-0.795814 1.798334,-1.875848 0.599445,-1.080034 0.682127,-3.079906 l 0.909502,0.07751 q 0,0.268716 -0.04134,0.671791 l -0.03617,0.361734 q 0,0.273884 0.30489,1.033525 0.310058,0.754474 0.899167,1.467606 0.594277,0.707965 1.452103,1.343583 z m -4.800725,-1.374588 -0.702797,0.63045 q -0.594277,-0.780312 -1.162716,-1.276404 -0.651121,1.421098 -2.020542,2.676831 l -0.687295,-0.614948 q 1.229895,-1.095537 1.767329,-2.201409 0.5426,-1.105872 0.697629,-2.795686 l 0.919838,0.09819 q -0.103353,0.940508 -0.366902,1.91719 1.00252,0.862993 1.555456,1.565791 z" style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Adobe Garamond Pro';-inkscape-font-specification:'Adobe Garamond Pro Bold';fill:#00000" id="path961"/>
|
||||||
|
</g>
|
||||||
|
<g aria-label="L" id="text841" style="font-style:normal;font-weight:normal;font-size:43.3964px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.08492">
|
||||||
|
<path d="M 84.81389,94.883148 V 91.324643 H 69.191186 V 63.247172 h -4.035865 v 31.635976 z" style="fill:#000000;stroke-width:1.08492" id="path964"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g id="g921" transform="translate(29.198135,-14.725175)"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
44
packages/backend/src/apps/libretranslate/auth/index.js
Normal file
44
packages/backend/src/apps/libretranslate/auth/index.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import verifyCredentials from './verify-credentials.js';
|
||||||
|
import isStillVerified from './is-still-verified.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'screenName',
|
||||||
|
label: 'Screen Name',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description:
|
||||||
|
'Screen name of your connection to be used on Automatisch UI.',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'instanceUrl',
|
||||||
|
label: 'Instance URL',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: 'For the self hosted version.',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'apiKey',
|
||||||
|
label: 'API Key',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
readOnly: false,
|
||||||
|
value: null,
|
||||||
|
placeholder: null,
|
||||||
|
description: 'LibreTranslate API key of your account.',
|
||||||
|
clickToCopy: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
verifyCredentials,
|
||||||
|
isStillVerified,
|
||||||
|
};
|
@@ -0,0 +1,8 @@
|
|||||||
|
import verifyCredentials from './verify-credentials.js';
|
||||||
|
|
||||||
|
const isStillVerified = async ($) => {
|
||||||
|
await verifyCredentials($);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default isStillVerified;
|
@@ -0,0 +1,14 @@
|
|||||||
|
const verifyCredentials = async ($) => {
|
||||||
|
const body = {
|
||||||
|
q: 'Hi!',
|
||||||
|
};
|
||||||
|
|
||||||
|
await $.http.post('/detect', body);
|
||||||
|
|
||||||
|
await $.auth.set({
|
||||||
|
screenName: $.auth.data.screenName,
|
||||||
|
apiKey: $.auth.data.apiKey,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default verifyCredentials;
|
@@ -0,0 +1,9 @@
|
|||||||
|
const addApiKey = ($, requestConfig) => {
|
||||||
|
const apiKey = $.auth.data.apiKey;
|
||||||
|
|
||||||
|
requestConfig.data = { api_key: apiKey, ...(requestConfig.data || {}) };
|
||||||
|
|
||||||
|
return requestConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default addApiKey;
|
@@ -0,0 +1,16 @@
|
|||||||
|
const setBaseUrl = ($, requestConfig) => {
|
||||||
|
const instanceUrl = $.auth.data.instanceUrl;
|
||||||
|
const apiKey = $.auth.data.apiKey;
|
||||||
|
|
||||||
|
if (instanceUrl) {
|
||||||
|
requestConfig.baseURL = instanceUrl;
|
||||||
|
} else if ($.app.apiBaseUrl) {
|
||||||
|
requestConfig.baseURL = $.app.apiBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestConfig.data = { api_key: apiKey, ...(requestConfig.data || {}) };
|
||||||
|
|
||||||
|
return requestConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default setBaseUrl;
|
17
packages/backend/src/apps/libretranslate/index.js
Normal file
17
packages/backend/src/apps/libretranslate/index.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import defineApp from '../../helpers/define-app.js';
|
||||||
|
import auth from './auth/index.js';
|
||||||
|
import addApiKey from './common/add-api-key.js';
|
||||||
|
import setBaseUrl from './common/set-base-url.js';
|
||||||
|
|
||||||
|
export default defineApp({
|
||||||
|
name: 'LibreTranslate',
|
||||||
|
key: 'libretranslate',
|
||||||
|
iconUrl: '{BASE_URL}/apps/libretranslate/assets/favicon.svg',
|
||||||
|
authDocUrl: '{DOCS_URL}/apps/libretranslate/connection',
|
||||||
|
supportsConnections: true,
|
||||||
|
baseUrl: 'https://libretranslate.com',
|
||||||
|
apiBaseUrl: 'https://libretranslate.com',
|
||||||
|
primaryColor: 'ffffff',
|
||||||
|
beforeRequest: [setBaseUrl, addApiKey],
|
||||||
|
auth,
|
||||||
|
});
|
@@ -1,262 +0,0 @@
|
|||||||
import defineAction from '../../../../helpers/define-action.js';
|
|
||||||
import isEmpty from 'lodash/isEmpty.js';
|
|
||||||
import omitBy from 'lodash/omitBy.js';
|
|
||||||
|
|
||||||
export default defineAction({
|
|
||||||
name: 'Create post',
|
|
||||||
key: 'createPost',
|
|
||||||
description: 'Creates a new post.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'Title',
|
|
||||||
key: 'title',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Content',
|
|
||||||
key: 'content',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Excerpt',
|
|
||||||
key: 'excerpt',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Password',
|
|
||||||
key: 'password',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: 'A password to protect access to the content and excerpt.',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Author',
|
|
||||||
key: 'author',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listUsers',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Featured Media',
|
|
||||||
key: 'featuredMedia',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listMedia',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Comment Status',
|
|
||||||
key: 'commentStatus',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Open', value: 'open' },
|
|
||||||
{ label: 'Closed', value: 'closed' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Ping Status',
|
|
||||||
key: 'pingStatus',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Open', value: 'open' },
|
|
||||||
{ label: 'Closed', value: 'closed' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Format',
|
|
||||||
key: 'format',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Standard', value: 'standard' },
|
|
||||||
{ label: 'Aside', value: 'aside' },
|
|
||||||
{ label: 'Chat', value: 'chat' },
|
|
||||||
{ label: 'Gallery', value: 'gallery' },
|
|
||||||
{ label: 'Link', value: 'link' },
|
|
||||||
{ label: 'Image', value: 'image' },
|
|
||||||
{ label: 'Quote', value: 'quote' },
|
|
||||||
{ label: 'Status', value: 'status' },
|
|
||||||
{ label: 'Status', value: 'status' },
|
|
||||||
{ label: 'Video', value: 'video' },
|
|
||||||
{ label: 'Audio', value: 'audio' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Sticky',
|
|
||||||
key: 'sticky',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'False', value: 'false' },
|
|
||||||
{ label: 'True', value: 'true' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Categories',
|
|
||||||
key: 'categoryIds',
|
|
||||||
type: 'dynamic',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Category',
|
|
||||||
key: 'categoryId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listCategories',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Tags',
|
|
||||||
key: 'tagIds',
|
|
||||||
type: 'dynamic',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Tag',
|
|
||||||
key: 'tagId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listTags',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Status',
|
|
||||||
key: 'status',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listStatuses',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Date',
|
|
||||||
key: 'date',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: "Post publish date in the site's timezone",
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const {
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
excerpt,
|
|
||||||
password,
|
|
||||||
author,
|
|
||||||
featuredMedia,
|
|
||||||
commentStatus,
|
|
||||||
pingStatus,
|
|
||||||
format,
|
|
||||||
sticky,
|
|
||||||
categoryIds,
|
|
||||||
tagIds,
|
|
||||||
status,
|
|
||||||
date,
|
|
||||||
} = $.step.parameters;
|
|
||||||
|
|
||||||
const allCategoryIds = categoryIds
|
|
||||||
?.map((categoryId) => categoryId.categoryId)
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
const allTagIds = tagIds?.map((tagId) => tagId.tagId).filter(Boolean);
|
|
||||||
|
|
||||||
let body = {
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
excerpt,
|
|
||||||
password,
|
|
||||||
author,
|
|
||||||
featured_media: featuredMedia,
|
|
||||||
comment_status: commentStatus,
|
|
||||||
ping_status: pingStatus,
|
|
||||||
format,
|
|
||||||
sticky,
|
|
||||||
categories: allCategoryIds,
|
|
||||||
tags: allTagIds,
|
|
||||||
status,
|
|
||||||
date,
|
|
||||||
};
|
|
||||||
|
|
||||||
body = omitBy(body, isEmpty);
|
|
||||||
|
|
||||||
const response = await $.http.post('?rest_route=/wp/v2/posts', body);
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,135 +0,0 @@
|
|||||||
import defineAction from '../../../../helpers/define-action.js';
|
|
||||||
import isEmpty from 'lodash/isEmpty.js';
|
|
||||||
import omitBy from 'lodash/omitBy.js';
|
|
||||||
|
|
||||||
export default defineAction({
|
|
||||||
name: 'Create user',
|
|
||||||
key: 'createUser',
|
|
||||||
description: 'Creates a new user.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'Email',
|
|
||||||
key: 'email',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Username',
|
|
||||||
key: 'username',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Password',
|
|
||||||
key: 'password',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'First Name',
|
|
||||||
key: 'firstName',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Last Name',
|
|
||||||
key: 'lastName',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Display Name',
|
|
||||||
key: 'displayName',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Nickname',
|
|
||||||
key: 'nickname',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Description',
|
|
||||||
key: 'description',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Website',
|
|
||||||
key: 'website',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Role',
|
|
||||||
key: 'role',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Administrator', value: 'administrator' },
|
|
||||||
{ label: 'Author', value: 'author' },
|
|
||||||
{ label: 'Contributor', value: 'contributor' },
|
|
||||||
{ label: 'Editor', value: 'editor' },
|
|
||||||
{ label: 'Subscriber', value: 'subscriber' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const {
|
|
||||||
email,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
firstName,
|
|
||||||
lastName,
|
|
||||||
displayName,
|
|
||||||
nickname,
|
|
||||||
description,
|
|
||||||
website,
|
|
||||||
role,
|
|
||||||
} = $.step.parameters;
|
|
||||||
|
|
||||||
let body = {
|
|
||||||
email,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
first_name: firstName,
|
|
||||||
last_name: lastName,
|
|
||||||
name: displayName,
|
|
||||||
nickname,
|
|
||||||
description,
|
|
||||||
url: website,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (role) {
|
|
||||||
body.roles = [role];
|
|
||||||
}
|
|
||||||
|
|
||||||
body = omitBy(body, isEmpty);
|
|
||||||
|
|
||||||
const response = await $.http.post('?rest_route=/wp/v2/users', body);
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,35 +0,0 @@
|
|||||||
import defineAction from '../../../../helpers/define-action.js';
|
|
||||||
|
|
||||||
export default defineAction({
|
|
||||||
name: 'Find post',
|
|
||||||
key: 'findPost',
|
|
||||||
description: 'Finds a post.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'Post ID',
|
|
||||||
key: 'postId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: 'Choose a post to update.',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listPosts',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const { postId } = $.step.parameters;
|
|
||||||
|
|
||||||
const response = await $.http.get(`?rest_route=/wp/v2/posts/${postId}`);
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,35 +0,0 @@
|
|||||||
import defineAction from '../../../../helpers/define-action.js';
|
|
||||||
|
|
||||||
export default defineAction({
|
|
||||||
name: 'Find user',
|
|
||||||
key: 'findUser',
|
|
||||||
description: 'Finds a user.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'User ID',
|
|
||||||
key: 'userId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listUsers',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const userId = $.step.parameters.userId;
|
|
||||||
|
|
||||||
const response = await $.http.get(`?rest_route=/wp/v2/users/${userId}`);
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,7 +0,0 @@
|
|||||||
import createPost from './create-post/index.js';
|
|
||||||
import createUser from './create-user/index.js';
|
|
||||||
import findPost from './find-post/index.js';
|
|
||||||
import findUser from './find-user/index.js';
|
|
||||||
import updatePost from './update-post/index.js';
|
|
||||||
|
|
||||||
export default [createPost, createUser, findPost, findUser, updatePost];
|
|
@@ -1,284 +0,0 @@
|
|||||||
import defineAction from '../../../../helpers/define-action.js';
|
|
||||||
import isEmpty from 'lodash/isEmpty.js';
|
|
||||||
import omitBy from 'lodash/omitBy.js';
|
|
||||||
|
|
||||||
export default defineAction({
|
|
||||||
name: 'Update post',
|
|
||||||
key: 'updatePost',
|
|
||||||
description: 'Updates a post.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'Post',
|
|
||||||
key: 'postId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: 'Choose a post to update.',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listPosts',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Title',
|
|
||||||
key: 'title',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Content',
|
|
||||||
key: 'content',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Excerpt',
|
|
||||||
key: 'excerpt',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Password',
|
|
||||||
key: 'password',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: 'A password to protect access to the content and excerpt.',
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Author',
|
|
||||||
key: 'author',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listUsers',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Featured Media',
|
|
||||||
key: 'featuredMedia',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listMedia',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Comment Status',
|
|
||||||
key: 'commentStatus',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Open', value: 'open' },
|
|
||||||
{ label: 'Closed', value: 'closed' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Ping Status',
|
|
||||||
key: 'pingStatus',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Open', value: 'open' },
|
|
||||||
{ label: 'Closed', value: 'closed' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Format',
|
|
||||||
key: 'format',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'Standard', value: 'standard' },
|
|
||||||
{ label: 'Aside', value: 'aside' },
|
|
||||||
{ label: 'Chat', value: 'chat' },
|
|
||||||
{ label: 'Gallery', value: 'gallery' },
|
|
||||||
{ label: 'Link', value: 'link' },
|
|
||||||
{ label: 'Image', value: 'image' },
|
|
||||||
{ label: 'Quote', value: 'quote' },
|
|
||||||
{ label: 'Status', value: 'status' },
|
|
||||||
{ label: 'Status', value: 'status' },
|
|
||||||
{ label: 'Video', value: 'video' },
|
|
||||||
{ label: 'Audio', value: 'audio' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Sticky',
|
|
||||||
key: 'sticky',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
options: [
|
|
||||||
{ label: 'False', value: 'false' },
|
|
||||||
{ label: 'True', value: 'true' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Categories',
|
|
||||||
key: 'categoryIds',
|
|
||||||
type: 'dynamic',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Category',
|
|
||||||
key: 'categoryId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listCategories',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Tags',
|
|
||||||
key: 'tagIds',
|
|
||||||
type: 'dynamic',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Tag',
|
|
||||||
key: 'tagId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listTags',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Status',
|
|
||||||
key: 'status',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listStatuses',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Date',
|
|
||||||
key: 'date',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
description: "Post publish date in the site's timezone",
|
|
||||||
variables: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const {
|
|
||||||
postId,
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
excerpt,
|
|
||||||
password,
|
|
||||||
author,
|
|
||||||
featuredMedia,
|
|
||||||
commentStatus,
|
|
||||||
pingStatus,
|
|
||||||
format,
|
|
||||||
sticky,
|
|
||||||
categoryIds,
|
|
||||||
tagIds,
|
|
||||||
status,
|
|
||||||
date,
|
|
||||||
} = $.step.parameters;
|
|
||||||
|
|
||||||
const allCategoryIds = categoryIds
|
|
||||||
?.map((categoryId) => categoryId.categoryId)
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
const allTagIds = tagIds?.map((tagId) => tagId.tagId).filter(Boolean);
|
|
||||||
|
|
||||||
let body = {
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
excerpt,
|
|
||||||
password,
|
|
||||||
author,
|
|
||||||
featured_media: featuredMedia,
|
|
||||||
comment_status: commentStatus,
|
|
||||||
ping_status: pingStatus,
|
|
||||||
format,
|
|
||||||
sticky,
|
|
||||||
categories: allCategoryIds,
|
|
||||||
tags: allTagIds,
|
|
||||||
status,
|
|
||||||
date,
|
|
||||||
};
|
|
||||||
|
|
||||||
body = omitBy(body, isEmpty);
|
|
||||||
|
|
||||||
const response = await $.http.post(
|
|
||||||
`?rest_route=/wp/v2/posts/${postId}`,
|
|
||||||
body
|
|
||||||
);
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,15 +1,3 @@
|
|||||||
import listCategories from './list-categories/index.js';
|
|
||||||
import listMedia from './list-media/index.js';
|
|
||||||
import listPosts from './list-posts/index.js';
|
|
||||||
import listStatuses from './list-statuses/index.js';
|
import listStatuses from './list-statuses/index.js';
|
||||||
import listTags from './list-tags/index.js';
|
|
||||||
import listUsers from './list-users/index.js';
|
|
||||||
|
|
||||||
export default [
|
export default [listStatuses];
|
||||||
listCategories,
|
|
||||||
listMedia,
|
|
||||||
listPosts,
|
|
||||||
listStatuses,
|
|
||||||
listTags,
|
|
||||||
listUsers,
|
|
||||||
];
|
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List categories',
|
|
||||||
key: 'listCategories',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const categories = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
per_page: 100,
|
|
||||||
order: 'desc',
|
|
||||||
};
|
|
||||||
|
|
||||||
let totalPages = 1;
|
|
||||||
do {
|
|
||||||
const { data, headers } = await $.http.get(
|
|
||||||
'?rest_route=/wp/v2/categories',
|
|
||||||
{
|
|
||||||
params,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
params.page = params.page + 1;
|
|
||||||
totalPages = Number(headers['x-wp-totalpages']);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
for (const category of data) {
|
|
||||||
categories.data.push({
|
|
||||||
value: category.id,
|
|
||||||
name: category.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (params.page <= totalPages);
|
|
||||||
|
|
||||||
return categories;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,37 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List media',
|
|
||||||
key: 'listMedia',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const media = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
per_page: 100,
|
|
||||||
order: 'desc',
|
|
||||||
};
|
|
||||||
|
|
||||||
let totalPages = 1;
|
|
||||||
do {
|
|
||||||
const { data, headers } = await $.http.get('?rest_route=/wp/v2/media', {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
|
|
||||||
params.page = params.page + 1;
|
|
||||||
totalPages = Number(headers['x-wp-totalpages']);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
for (const medium of data) {
|
|
||||||
media.data.push({
|
|
||||||
value: medium.id,
|
|
||||||
name: medium.slug,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (params.page <= totalPages);
|
|
||||||
|
|
||||||
return media;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,37 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List posts',
|
|
||||||
key: 'listPosts',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const posts = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
per_page: 100,
|
|
||||||
order: 'desc',
|
|
||||||
};
|
|
||||||
|
|
||||||
let totalPages = 1;
|
|
||||||
do {
|
|
||||||
const { data, headers } = await $.http.get('?rest_route=/wp/v2/posts', {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
|
|
||||||
params.page = params.page + 1;
|
|
||||||
totalPages = Number(headers['x-wp-totalpages']);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
for (const post of data) {
|
|
||||||
posts.data.push({
|
|
||||||
value: post.id,
|
|
||||||
name: post.title.rendered,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (params.page <= totalPages);
|
|
||||||
|
|
||||||
return posts;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,37 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List tags',
|
|
||||||
key: 'listTags',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const tags = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
per_page: 100,
|
|
||||||
order: 'desc',
|
|
||||||
};
|
|
||||||
|
|
||||||
let totalPages = 1;
|
|
||||||
do {
|
|
||||||
const { data, headers } = await $.http.get('?rest_route=/wp/v2/tags', {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
|
|
||||||
params.page = params.page + 1;
|
|
||||||
totalPages = Number(headers['x-wp-totalpages']);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
for (const tag of data) {
|
|
||||||
tags.data.push({
|
|
||||||
value: tag.id,
|
|
||||||
name: tag.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (params.page <= totalPages);
|
|
||||||
|
|
||||||
return tags;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,37 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List users',
|
|
||||||
key: 'listUsers',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const users = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 1,
|
|
||||||
per_page: 100,
|
|
||||||
order: 'desc',
|
|
||||||
};
|
|
||||||
|
|
||||||
let totalPages = 1;
|
|
||||||
do {
|
|
||||||
const { data, headers } = await $.http.get('?rest_route=/wp/v2/users', {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
|
|
||||||
params.page = params.page + 1;
|
|
||||||
totalPages = Number(headers['x-wp-totalpages']);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
for (const user of data) {
|
|
||||||
users.data.push({
|
|
||||||
value: user.id,
|
|
||||||
name: user.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (params.page <= totalPages);
|
|
||||||
|
|
||||||
return users;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -4,7 +4,6 @@ import setBaseUrl from './common/set-base-url.js';
|
|||||||
import auth from './auth/index.js';
|
import auth from './auth/index.js';
|
||||||
import triggers from './triggers/index.js';
|
import triggers from './triggers/index.js';
|
||||||
import dynamicData from './dynamic-data/index.js';
|
import dynamicData from './dynamic-data/index.js';
|
||||||
import actions from './actions/index.js';
|
|
||||||
|
|
||||||
export default defineApp({
|
export default defineApp({
|
||||||
name: 'WordPress',
|
name: 'WordPress',
|
||||||
@@ -19,5 +18,4 @@ export default defineApp({
|
|||||||
auth,
|
auth,
|
||||||
triggers,
|
triggers,
|
||||||
dynamicData,
|
dynamicData,
|
||||||
actions,
|
|
||||||
});
|
});
|
||||||
|
@@ -52,7 +52,7 @@ const appConfig = {
|
|||||||
isDev: appEnv === 'development',
|
isDev: appEnv === 'development',
|
||||||
isTest: appEnv === 'test',
|
isTest: appEnv === 'test',
|
||||||
isProd: appEnv === 'production',
|
isProd: appEnv === 'production',
|
||||||
version: '0.11.0',
|
version: '0.12.0',
|
||||||
postgresDatabase: process.env.POSTGRES_DATABASE || 'automatisch_development',
|
postgresDatabase: process.env.POSTGRES_DATABASE || 'automatisch_development',
|
||||||
postgresSchema: process.env.POSTGRES_SCHEMA || 'public',
|
postgresSchema: process.env.POSTGRES_SCHEMA || 'public',
|
||||||
postgresPort: parseInt(process.env.POSTGRES_PORT || '5432'),
|
postgresPort: parseInt(process.env.POSTGRES_PORT || '5432'),
|
||||||
|
@@ -10,7 +10,7 @@ describe('GET /api/v1/automatisch/version', () => {
|
|||||||
|
|
||||||
const expectedPayload = {
|
const expectedPayload = {
|
||||||
data: {
|
data: {
|
||||||
version: '0.11.0',
|
version: '0.12.0',
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
count: 1,
|
count: 1,
|
||||||
|
@@ -243,6 +243,14 @@ export default defineConfig({
|
|||||||
{ text: 'Connection', link: '/apps/invoice-ninja/connection' },
|
{ text: 'Connection', link: '/apps/invoice-ninja/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: 'LibreTranslate',
|
||||||
|
collapsible: true,
|
||||||
|
collapsed: true,
|
||||||
|
items: [
|
||||||
|
{ text: 'Connection', link: '/apps/libretranslate/connection' },
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: 'Mattermost',
|
text: 'Mattermost',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
@@ -518,7 +526,6 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Actions', link: '/apps/wordpress/actions' },
|
|
||||||
{ text: 'Triggers', link: '/apps/wordpress/triggers' },
|
{ text: 'Triggers', link: '/apps/wordpress/triggers' },
|
||||||
{ text: 'Connection', link: '/apps/wordpress/connection' },
|
{ text: 'Connection', link: '/apps/wordpress/connection' },
|
||||||
],
|
],
|
||||||
|
12
packages/docs/pages/apps/libretranslate/connection.md
Normal file
12
packages/docs/pages/apps/libretranslate/connection.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# LibreTranslate
|
||||||
|
|
||||||
|
:::info
|
||||||
|
This page explains the steps you need to follow to set up the LibreTranslate
|
||||||
|
connection in Automatisch. If any of the steps are outdated, please let us know!
|
||||||
|
:::
|
||||||
|
|
||||||
|
1. Login to your LibreTranslate account.
|
||||||
|
2. Copy your `API key` from the page to the `API Key` field on Automatisch.
|
||||||
|
3. If you are using a self hosted version of LibreTranslate, copy your `Instance URl` to the `Instance URL` field on Automatisch.
|
||||||
|
4. Write any screen name to be displayed in Automatisch.
|
||||||
|
5. Now, you can start using the LibreTranslate connection with Automatisch.
|
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
favicon: /favicons/wordpress.svg
|
|
||||||
items:
|
|
||||||
- name: Create post
|
|
||||||
desc: Creates a new post.
|
|
||||||
- name: Create user
|
|
||||||
desc: Creates a new user.
|
|
||||||
- name: Find post
|
|
||||||
desc: Finds a post.
|
|
||||||
- name: Find user
|
|
||||||
desc: Finds a user.
|
|
||||||
- name: Update post
|
|
||||||
desc: Updates a post.
|
|
||||||
---
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import CustomListing from '../../components/CustomListing.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<CustomListing />
|
|
28
packages/docs/pages/public/favicons/libretranslate.svg
Normal file
28
packages/docs/pages/public/favicons/libretranslate.svg
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="187.04305" height="188.81523" viewBox="0 0 49.488472 49.957363" version="1.1" id="svg8">
|
||||||
|
<defs id="defs2">
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect835"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect835-7"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect874"/>
|
||||||
|
<rect x="25.162016" y="84.327377" width="71.115189" height="52.835255" id="rect923"/>
|
||||||
|
</defs>
|
||||||
|
<metadata id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
|
<dc:title/>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g id="layer1" transform="translate(-23.040803,-26.932047)">
|
||||||
|
<g id="g861" transform="translate(-42.114518,-17.993737)" style="fill:#000000">
|
||||||
|
<g aria-label="众" transform="matrix(4.3205134,0,0,4.3205134,-37.271798,-327.6536)" id="text833" style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect835);fill:#000000;fill-opacity:1;stroke:none">
|
||||||
|
<path d="m 34.996103,90.121035 -0.614947,0.759641 q -2.754346,-1.41593 -3.948067,-2.950715 -1.167884,1.617467 -3.7672,2.888703 L 26.0096,90.084861 q 3.457142,-1.601964 4.283963,-3.849882 l 0.878496,0.273884 q -0.175699,0.516763 -0.232543,0.604613 1.116207,1.596797 4.056587,3.007559 z m 0.165364,4.91958 -0.676959,0.645954 q -1.514115,-1.157549 -2.346102,-2.826692 -0.547769,1.550288 -2.268589,2.806021 l -0.676959,-0.625283 q 1.19889,-0.795814 1.798334,-1.875848 0.599445,-1.080034 0.682127,-3.079906 l 0.909502,0.07751 q 0,0.268716 -0.04134,0.671791 l -0.03617,0.361734 q 0,0.273884 0.30489,1.033525 0.310058,0.754474 0.899167,1.467606 0.594277,0.707965 1.452103,1.343583 z m -4.800725,-1.374588 -0.702797,0.63045 q -0.594277,-0.780312 -1.162716,-1.276404 -0.651121,1.421098 -2.020542,2.676831 l -0.687295,-0.614948 q 1.229895,-1.095537 1.767329,-2.201409 0.5426,-1.105872 0.697629,-2.795686 l 0.919838,0.09819 q -0.103353,0.940508 -0.366902,1.91719 1.00252,0.862993 1.555456,1.565791 z" style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Adobe Garamond Pro';-inkscape-font-specification:'Adobe Garamond Pro Bold';fill:#00000" id="path961"/>
|
||||||
|
</g>
|
||||||
|
<g aria-label="L" id="text841" style="font-style:normal;font-weight:normal;font-size:43.3964px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.08492">
|
||||||
|
<path d="M 84.81389,94.883148 V 91.324643 H 69.191186 V 63.247172 h -4.035865 v 31.635976 z" style="fill:#000000;stroke-width:1.08492" id="path964"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g id="g921" transform="translate(29.198135,-14.725175)"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
@@ -36,7 +36,7 @@ function AdminApplicationSettings(props) {
|
|||||||
|
|
||||||
const handleSubmit = async (values) => {
|
const handleSubmit = async (values) => {
|
||||||
try {
|
try {
|
||||||
if (!appConfig.data) {
|
if (!appConfig?.data) {
|
||||||
await createAppConfig({
|
await createAppConfig({
|
||||||
variables: {
|
variables: {
|
||||||
input: { key: props.appKey, ...values },
|
input: { key: props.appKey, ...values },
|
||||||
@@ -69,6 +69,7 @@ function AdminApplicationSettings(props) {
|
|||||||
}),
|
}),
|
||||||
[appConfig?.data],
|
[appConfig?.data],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
defaultValues={defaultValues}
|
defaultValues={defaultValues}
|
||||||
|
@@ -28,9 +28,12 @@ function ContextMenu(props) {
|
|||||||
variables: { input: { id: flowId } },
|
variables: { input: { id: flowId } },
|
||||||
});
|
});
|
||||||
|
|
||||||
await queryClient.invalidateQueries({
|
if (appKey) {
|
||||||
queryKey: ['apps', appKey, 'flows'],
|
await queryClient.invalidateQueries({
|
||||||
});
|
queryKey: ['apps', appKey, 'flows'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
enqueueSnackbar(formatMessage('flow.successfullyDuplicated'), {
|
enqueueSnackbar(formatMessage('flow.successfullyDuplicated'), {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
SnackbarProps: {
|
SnackbarProps: {
|
||||||
@@ -56,9 +59,12 @@ function ContextMenu(props) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await queryClient.invalidateQueries({
|
if (appKey) {
|
||||||
queryKey: ['apps', appKey, 'flows'],
|
await queryClient.invalidateQueries({
|
||||||
});
|
queryKey: ['apps', appKey, 'flows'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
enqueueSnackbar(formatMessage('flow.successfullyDeleted'), {
|
enqueueSnackbar(formatMessage('flow.successfullyDeleted'), {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
});
|
});
|
||||||
@@ -110,7 +116,7 @@ ContextMenu.propTypes = {
|
|||||||
]).isRequired,
|
]).isRequired,
|
||||||
onDeleteFlow: PropTypes.func,
|
onDeleteFlow: PropTypes.func,
|
||||||
onDuplicateFlow: PropTypes.func,
|
onDuplicateFlow: PropTypes.func,
|
||||||
appKey: PropTypes.string.isRequired,
|
appKey: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ContextMenu;
|
export default ContextMenu;
|
||||||
|
@@ -38,20 +38,24 @@ function FlowRow(props) {
|
|||||||
const contextButtonRef = React.useRef(null);
|
const contextButtonRef = React.useRef(null);
|
||||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||||
const { flow, onDuplicateFlow, onDeleteFlow, appKey } = props;
|
const { flow, onDuplicateFlow, onDeleteFlow, appKey } = props;
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onContextMenuClick = (event) => {
|
const onContextMenuClick = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.nativeEvent.stopImmediatePropagation();
|
event.nativeEvent.stopImmediatePropagation();
|
||||||
setAnchorEl(contextButtonRef.current);
|
setAnchorEl(contextButtonRef.current);
|
||||||
};
|
};
|
||||||
|
|
||||||
const createdAt = DateTime.fromMillis(parseInt(flow.createdAt, 10));
|
const createdAt = DateTime.fromMillis(parseInt(flow.createdAt, 10));
|
||||||
const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt, 10));
|
const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt, 10));
|
||||||
const isUpdated = updatedAt > createdAt;
|
const isUpdated = updatedAt > createdAt;
|
||||||
const relativeCreatedAt = createdAt.toRelative();
|
const relativeCreatedAt = createdAt.toRelative();
|
||||||
const relativeUpdatedAt = updatedAt.toRelative();
|
const relativeUpdatedAt = updatedAt.toRelative();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card sx={{ mb: 1 }} data-test="flow-row">
|
<Card sx={{ mb: 1 }} data-test="flow-row">
|
||||||
@@ -127,7 +131,7 @@ FlowRow.propTypes = {
|
|||||||
flow: FlowPropType.isRequired,
|
flow: FlowPropType.isRequired,
|
||||||
onDeleteFlow: PropTypes.func,
|
onDeleteFlow: PropTypes.func,
|
||||||
onDuplicateFlow: PropTypes.func,
|
onDuplicateFlow: PropTypes.func,
|
||||||
appKey: PropTypes.string.isRequired,
|
appKey: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FlowRow;
|
export default FlowRow;
|
||||||
|
Reference in New Issue
Block a user