Merge branch 'main' into ocf-alteeve-server-fixes

main
Digimer 1 year ago committed by GitHub
commit 26b932f001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      striker-ui-api/out/index.js
  2. 7
      striker-ui-api/src/app.ts
  3. 27
      striker-ui-api/src/lib/accessModule.ts
  4. 18
      striker-ui-api/src/lib/request_handlers/host/createHostConnection.ts
  5. 2
      striker-ui-api/src/lib/sanitize.ts
  6. 2
      striker-ui/components/StrikerConfig/AddPeerDialog.tsx
  7. 1
      striker-ui/out/_next/static/chunks/pages/config-0ecdb2b2b3f8c089.js
  8. 1
      striker-ui/out/_next/static/chunks/pages/config-9d47390f2a09a755.js
  9. 2
      striker-ui/out/_next/static/iwLyQ1EJH6yXjS_p5n_oV/_buildManifest.js
  10. 0
      striker-ui/out/_next/static/iwLyQ1EJH6yXjS_p5n_oV/_middlewareManifest.js
  11. 0
      striker-ui/out/_next/static/iwLyQ1EJH6yXjS_p5n_oV/_ssgManifest.js
  12. 2
      striker-ui/out/anvil.html
  13. 2
      striker-ui/out/config.html
  14. 2
      striker-ui/out/file-manager.html
  15. 2
      striker-ui/out/index.html
  16. 2
      striker-ui/out/init.html
  17. 2
      striker-ui/out/login.html
  18. 2
      striker-ui/out/manage-element.html
  19. 2
      striker-ui/out/server.html

File diff suppressed because one or more lines are too long

@ -4,6 +4,7 @@ import express, { json } from 'express';
import { guardApi, passport, session } from './middlewares';
import routes from './routes';
import { rrouters } from './lib/rrouters';
import { stdout } from './lib/shell';
export default (async () => {
const app = express();
@ -24,6 +25,12 @@ export default (async () => {
app.use(passport.initialize());
app.use(passport.authenticate('session'));
app.use(({ originalUrl, method }, response, next) => {
stdout(`Received ${method} ${originalUrl}`);
next();
});
rrouters(app, routes.private, {
assign: (router) => [guardApi, router],
route: '/api',

@ -15,7 +15,6 @@ import {
class Access extends EventEmitter {
private ps: ChildProcess;
private queue: string[] = [];
constructor({
eventEmitterOptions = {},
@ -50,19 +49,10 @@ class Access extends EventEmitter {
...restSpawnOptions,
});
let stderr = '';
let stdout = '';
ps.stderr?.setEncoding('utf-8').on('data', (chunk: string) => {
stderr += chunk;
const scriptId: string | undefined = this.queue[0];
if (scriptId) {
sherr(`${Access.event(scriptId, 'stderr')}: ${stderr}`);
stderr = '';
}
sherr(`anvil-access-module daemon stderr: ${chunk}`);
});
ps.stdout?.setEncoding('utf-8').on('data', (chunk: string) => {
@ -73,9 +63,10 @@ class Access extends EventEmitter {
// 1. ~a is the shorthand for -(a + 1)
// 2. negatives are evaluated to true
while (~nindex) {
const scriptId = this.queue.shift();
const scriptId = stdout.substring(0, 36);
const output = stdout.substring(36, nindex);
if (scriptId) this.emit(scriptId, stdout.substring(0, nindex));
if (scriptId) this.emit(scriptId, output);
stdout = stdout.substring(nindex + 1);
nindex = stdout.indexOf('\n');
@ -97,15 +88,12 @@ class Access extends EventEmitter {
this.stop();
}
private static event(scriptId: string, category: 'stderr'): string {
return `${scriptId}-${category}`;
}
public interact<T>(command: string, ...args: string[]) {
public interact<T>(operation: string, ...args: string[]) {
const { stdin } = this.ps;
const scriptId = uuid();
const script = `${command} ${args.join(' ')}\n`;
const command = `${operation} ${args.join(' ')}`;
const script = `${scriptId} ${command}\n`;
const promise = new Promise<T>((resolve, reject) => {
this.once(scriptId, (data) => {
@ -123,7 +111,6 @@ class Access extends EventEmitter {
shvar({ scriptId, script }, 'Access interact: ');
this.queue.push(scriptId);
stdin?.write(script);
return promise;

@ -18,24 +18,16 @@ export const createHostConnection: RequestHandler<
CreateHostConnectionRequestBody
> = async (request, response) => {
const {
body: {
dbName = 'anvil',
ipAddress,
isPing = false,
password,
port = 5432,
sshPort = 22,
user = 'admin',
},
body: { dbName, ipAddress, isPing, password, port, sshPort, user },
} = request;
const commonDBName = sanitize(dbName, 'string');
const commonDBName = sanitize(dbName, 'string', { fallback: 'anvil' });
const commonIsPing = sanitize(isPing, 'boolean');
const commonPassword = sanitize(password, 'string');
const commonDBPort = sanitize(port, 'number');
const commonDBUser = sanitize(user, 'string');
const commonDBPort = sanitize(port, 'number', { fallback: 5432 });
const commonDBUser = sanitize(user, 'string', { fallback: 'root' });
const peerIPAddress = sanitize(ipAddress, 'string');
const peerSSHPort = sanitize(sshPort, 'number');
const peerSSHPort = sanitize(sshPort, 'number', { fallback: 22 });
const commonPing = commonIsPing ? 1 : 0;

@ -29,7 +29,7 @@ const MAP_TO_MODIFIER_FUNCTION: MapToModifierFunction = {
};
const MAP_TO_RETURN_FUNCTION: MapToReturnFunction = {
boolean: (value) => value !== undefined,
boolean: (value) => Boolean(value),
number: (value, mod, fallback = 0) => parseFloat(String(value)) || fallback,
string: (value, mod, fallback = '') => (value ? mod(value) : fallback),
'string[]': (value, mod, fallback = []) => {

@ -102,7 +102,7 @@ const AddPeerDialog = forwardRef<
sx: { minWidth: '4.6em', width: '25%' },
}}
id="add-peer-user-input"
inputProps={{ placeholder: 'admin' }}
inputProps={{ placeholder: 'root' }}
label={LABEL.user}
/>
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,i,f,d,u,b,k,h,j,r,g){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,a,e,i,f,k,"static/chunks/717-8bd60b96d67fd464.js",c,t,n,d,h,j,"static/chunks/pages/index-1f8f0ad3b3894dbc.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,a,e,i,f,k,c,t,n,d,h,"static/chunks/pages/anvil-c1177b17efcafc34.js"],"/config":[s,a,e,u,c,t,n,b,"static/chunks/pages/config-0ecdb2b2b3f8c089.js"],"/file-manager":[s,a,e,i,"static/chunks/768-9ee3dcb62beecb53.js",c,t,"static/chunks/pages/file-manager-1a707639a4834587.js"],"/init":[s,a,i,f,u,r,c,t,n,d,g,"static/chunks/pages/init-ae1befa8975f7914.js"],"/login":[s,a,e,c,t,n,b,"static/chunks/pages/login-b5de0cd2f49998d6.js"],"/manage-element":[s,a,e,i,f,u,r,"static/chunks/195-d5fd184cc249f755.js",c,t,n,d,b,g,"static/chunks/pages/manage-element-2b1d8792c2a5bf47.js"],"/server":[s,e,"static/chunks/227-a3756585a7ef09ae.js",c,j,"static/chunks/pages/server-db52258419acacf3.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/483-f8013e38dca1620d.js","static/chunks/894-e57948de523bcf96.js","static/chunks/780-e8b3396d257460a4.js","static/chunks/899-83e9de2a35c6bcf0.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/614-0ce04fd295045ffe.js","static/chunks/140-ec935fb15330b98a.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/903-dc2a40be612a10c3.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-d34974d169ea09cc.js","static/chunks/94-db0af749b6e45543.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/692-59a4ae2829590f4c.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
self.__BUILD_MANIFEST=function(s,a,c,e,t,n,i,f,d,u,b,k,h,j,r,g){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,c,e,i,f,k,"static/chunks/717-8bd60b96d67fd464.js",a,t,n,d,h,j,"static/chunks/pages/index-1f8f0ad3b3894dbc.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,c,e,i,f,k,a,t,n,d,h,"static/chunks/pages/anvil-c1177b17efcafc34.js"],"/config":[s,c,e,u,a,t,n,b,"static/chunks/pages/config-9d47390f2a09a755.js"],"/file-manager":[s,c,e,i,"static/chunks/768-9ee3dcb62beecb53.js",a,t,"static/chunks/pages/file-manager-1a707639a4834587.js"],"/init":[s,c,i,f,u,r,a,t,n,d,g,"static/chunks/pages/init-ae1befa8975f7914.js"],"/login":[s,c,e,a,t,n,b,"static/chunks/pages/login-b5de0cd2f49998d6.js"],"/manage-element":[s,c,e,i,f,u,r,"static/chunks/195-d5fd184cc249f755.js",a,t,n,d,b,g,"static/chunks/pages/manage-element-2b1d8792c2a5bf47.js"],"/server":[s,e,"static/chunks/227-a3756585a7ef09ae.js",a,j,"static/chunks/pages/server-db52258419acacf3.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/483-f8013e38dca1620d.js","static/chunks/894-e57948de523bcf96.js","static/chunks/780-e8b3396d257460a4.js","static/chunks/899-83e9de2a35c6bcf0.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/614-0ce04fd295045ffe.js","static/chunks/140-ec935fb15330b98a.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/903-dc2a40be612a10c3.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-d34974d169ea09cc.js","static/chunks/94-db0af749b6e45543.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/692-59a4ae2829590f4c.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save