mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:28:29 +02:00
Various tweaks
This commit is contained in:
@@ -4,12 +4,20 @@ import { parentPort, workerData } from 'node:worker_threads';
|
|||||||
import { ParentToWorkerEvent } from './PluginHandle';
|
import { ParentToWorkerEvent } from './PluginHandle';
|
||||||
import { PluginInfo } from './plugins';
|
import { PluginInfo } from './plugins';
|
||||||
|
|
||||||
new Promise(async () => {
|
new Promise<void>(async (resolve, reject) => {
|
||||||
const { pluginDir } = workerData;
|
const { pluginDir } = workerData;
|
||||||
const pathMod = path.join(pluginDir, 'build/index.js');
|
const pathMod = path.join(pluginDir, 'build/index.js');
|
||||||
const pathPkg = path.join(pluginDir, 'package.json');
|
const pathPkg = path.join(pluginDir, 'package.json');
|
||||||
|
|
||||||
const pkg = JSON.parse(readFileSync(pathPkg, 'utf8'));
|
let pkg: { [x: string]: any };
|
||||||
|
try {
|
||||||
|
pkg = JSON.parse(readFileSync(pathPkg, 'utf8'));
|
||||||
|
} catch (err) {
|
||||||
|
// TODO: Do something better here
|
||||||
|
reject(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const mod = (await import(`file://${pathMod}`)).default ?? {};
|
const mod = (await import(`file://${pathMod}`)).default ?? {};
|
||||||
|
|
||||||
const info: PluginInfo = {
|
const info: PluginInfo = {
|
||||||
@@ -43,15 +51,15 @@ new Promise(async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parentPort!.on('message', (msg: ParentToWorkerEvent) => {
|
parentPort!.on('message', async (msg: ParentToWorkerEvent) => {
|
||||||
try {
|
try {
|
||||||
const ctx = { todo: 'implement me' };
|
const ctx = { todo: 'implement me' };
|
||||||
if (msg.name === 'run-import') {
|
if (msg.name === 'run-import') {
|
||||||
reply(msg, mod.pluginHookImport(ctx, msg.payload));
|
reply(msg, await mod.pluginHookImport(ctx, msg.payload));
|
||||||
} else if (msg.name === 'run-filter') {
|
} else if (msg.name === 'run-filter') {
|
||||||
reply(msg, mod.pluginHookResponseFilter(ctx, msg.payload));
|
reply(msg, await mod.pluginHookResponseFilter(ctx, msg.payload));
|
||||||
} else if (msg.name === 'run-export') {
|
} else if (msg.name === 'run-export') {
|
||||||
reply(msg, mod.pluginHookExport(ctx, msg.payload));
|
reply(msg, await mod.pluginHookExport(ctx, msg.payload));
|
||||||
} else if (msg.name === 'info') {
|
} else if (msg.name === 'info') {
|
||||||
reply(msg, info);
|
reply(msg, info);
|
||||||
} else {
|
} else {
|
||||||
@@ -61,6 +69,8 @@ new Promise(async () => {
|
|||||||
replyErr(msg, err);
|
replyErr(msg, err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
resolve();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log('failed to boot plugin', err);
|
console.log('failed to boot plugin', err);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ pub async fn track_event(
|
|||||||
|
|
||||||
// Disable analytics actual sending in dev
|
// Disable analytics actual sending in dev
|
||||||
if is_dev() {
|
if is_dev() {
|
||||||
debug!("track: {}", event);
|
debug!("track: {} {}", event, attributes_json);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ impl YaakNotifier {
|
|||||||
("launches", num_launches.to_string()),
|
("launches", num_launches.to_string()),
|
||||||
]);
|
]);
|
||||||
let resp = req.send().await.map_err(|e| e.to_string())?;
|
let resp = req.send().await.map_err(|e| e.to_string())?;
|
||||||
|
if resp.status().to_string() != "200" {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let notification = resp
|
let notification = resp
|
||||||
.json::<YaakNotification>()
|
.json::<YaakNotification>()
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ pub async fn node_start<R: Runtime>(app: &AppHandle<R>, temp_dir: &PathBuf) -> S
|
|||||||
// read events such as stdout
|
// read events such as stdout
|
||||||
while let Some(event) = rx.recv().await {
|
while let Some(event) = rx.recv().await {
|
||||||
if let CommandEvent::Stdout(line) = event {
|
if let CommandEvent::Stdout(line) = event {
|
||||||
println!("{}", String::from_utf8_lossy(line.as_slice()));
|
print!("{}", String::from_utf8_lossy(line.as_slice()));
|
||||||
} else if let CommandEvent::Stderr(line) = event {
|
} else if let CommandEvent::Stderr(line) = event {
|
||||||
println!("{}", String::from_utf8_lossy(line.as_slice()));
|
print!("{}", String::from_utf8_lossy(line.as_slice()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ export function ImportDataDialog({ importData }: Props) {
|
|||||||
<VStack space={5} className="pb-4">
|
<VStack space={5} className="pb-4">
|
||||||
<VStack space={1}>
|
<VStack space={1}>
|
||||||
<ul className="list-disc pl-5">
|
<ul className="list-disc pl-5">
|
||||||
<li>Postman Collection v2+</li>
|
<li>OpenAPI 3.0, 3.1</li>
|
||||||
|
<li>Postman Collection v2, v2.1</li>
|
||||||
<li>Insomnia v4+</li>
|
<li>Insomnia v4+</li>
|
||||||
|
<li>Swagger 2.0</li>
|
||||||
<li>Curl commands</li>
|
<li>Curl commands</li>
|
||||||
</ul>
|
</ul>
|
||||||
<Banner className="mt-3 flex items-center gap-2">
|
<Banner className="mt-3 flex items-center gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user