Skip to content

feat: dynamic pp calculator switching#635

Open
storycraft wants to merge 47 commits into
masterfrom
feat/pp-switcher
Open

feat: dynamic pp calculator switching#635
storycraft wants to merge 47 commits into
masterfrom
feat/pp-switcher

Conversation

@storycraft

@storycraft storycraft commented Jun 23, 2026

Copy link
Copy Markdown
Member

Todo

  • Dashboard settings
  • Move calculator typings and imports to separated package.

Comment thread packages/pp-module-loader/src/index.ts Fixed
Comment thread packages/pp-module-loader/src/registry.ts Outdated
Comment thread packages/pp-module-loader/src/downloader.ts Outdated
Comment thread packages/pp-module-loader/src/downloader.ts Outdated
Comment thread packages/pp-module-loader/src/downloader.ts
Comment on lines +34 to +38
await tar.x({
file: archivePath,
cwd: folderPath,
strip: 1
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yesterday i had to unpack .tar.gz & .tgz, for that i used system tar with calling execFile, and as far as i know it's installed by default on windows and linux

import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
import path from 'path';


async function extractTar(file_path: string, destination: string, args: string[]): Promise<string | Error> {
	try {
		const tgz_path = path.resolve(file_path);
		const dest_path = path.resolve(destination);

		const result = await promisify(execFile)('tar', ['-xzf', `${tgz_path}`, '-C', `${dest_path}`, ...args]);
		if (result.stderr) return new Error(result.stderr);

		return result.stdout;
	} catch (error: any) {
		return error.code === 'ENOENT'
			? new Error('The "tar" command is not found in your system PATH. Please ensure it is installed.')
			: error;
	};
};

example of usage:

const extract = await extractTar(file_path, cache_directory, ['--strip-components=2']);
if (extract.status == 'error') {
	console.error(`extracting failed`, extract);
	process.exit(1);
};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea if it's good idea to rely on os command

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread packages/pp-module-loader/package.json Outdated
@storycraft
storycraft requested a review from cyperdark June 26, 2026 13:46
@storycraft
storycraft marked this pull request as ready for review June 26, 2026 19:02
@storycraft
storycraft requested a review from KotRikD June 26, 2026 19:02
Comment thread packages/pp-module-loader/src/index.ts Outdated
Comment thread packages/pp-module-loader/src/index.ts Outdated
Comment thread packages/pp-module-loader/src/index.ts Outdated
case 'dist-tag': {
wLogger.info(
'[calculator]',
`Using dist-tag "${module.tag}" calculator`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These log messages really do not tell anything for the end user.
Either make them end user friendly, or move them to debug.

@GabuTheDev GabuTheDev added area:server The nodejs backend of tosu. area:calc The pp calculator of tosu. labels Jul 5, 2026
@GabuTheDev GabuTheDev added the changelog worthy Has meaning for users; should be mentioned in next changelog. label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:calc The pp calculator of tosu. area:server The nodejs backend of tosu. changelog worthy Has meaning for users; should be mentioned in next changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants