Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: chat robot #252

Merged
merged 7 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<<<<<<< HEAD
## [0.3.2](https://github.com/Postcatlab/postcat/compare/v0.2.1...v0.3.2) (2023-03-06)
=======
## [0.3.2](https://github.com/Postcatlab/postcat/compare/v0.3.1...v0.3.2) (2023-03-07)


Expand All @@ -14,6 +17,7 @@


## [0.3.1](https://github.com/Postcatlab/postcat/compare/v0.2.1...v0.3.1) (2023-03-06)
>>>>>>> main


### Bug Fixes
Expand Down Expand Up @@ -46,6 +50,10 @@
* API Authorization ([938ec7d](https://github.com/Postcatlab/postcat/commit/938ec7d68270c2be4c17cd2e1098377f2db180d2))
* change description ([0341ba8](https://github.com/Postcatlab/postcat/commit/0341ba8f423cd6554fc83c50bf477dd9d1b36a9c))
* change github project url ([42c801c](https://github.com/Postcatlab/postcat/commit/42c801c49cbd859c876e9aafc2d4bae8fb38b9b6))
<<<<<<< HEAD
* chat robot ([7878664](https://github.com/Postcatlab/postcat/commit/78786640f464f7370c14aaf14bb224c61a29ae03))
=======
>>>>>>> main
* delete useless code ([a558094](https://github.com/Postcatlab/postcat/commit/a55809494695b1cdcb44009ca55213ca2fc2a570))
* delete useless log ([d878582](https://github.com/Postcatlab/postcat/commit/d87858232292f61f89e1412b259dc27b5e644a79))
* nps ([426a08f](https://github.com/Postcatlab/postcat/commit/426a08ff1af75d401a8358dae1940f4cfd8f3268))
Expand Down
4 changes: 2 additions & 2 deletions src/app/electron-main/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import log from 'electron-log';
import { autoUpdater } from 'electron-updater';

import { ELETRON_APP_CONFIG } from '../../environment';
import { COMMON_APP_CONFIG } from '../../environment';

const appVersion = require('../../../package.json').version;

Expand All @@ -11,7 +11,7 @@ export class EoUpdater {
this.watchLog();
autoUpdater.setFeedURL({
provider: 'generic',
url: ELETRON_APP_CONFIG.BASE_DOWNLOAD_URL
url: COMMON_APP_CONFIG.BASE_DOWNLOAD_URL
});
// 是否自动更新
// autoUpdater.autoDownload = window.pc.getExtensionSettings('common.app.autoUpdate') !== false;
Expand Down
9 changes: 8 additions & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
export const ELETRON_APP_CONFIG = {
const variables = {
GITHUB_ORANIZATION_NAME: 'postcatlab',
GITHUB_PROJECT_NAME: 'postcat'
};
export const COMMON_APP_CONFIG = {
// EXTENSION_URL: 'http://localhost:5000',
EXTENSION_URL: 'https://extensions.postcat.com',
REMOTE_SOCKET_URL: 'wss://postcat.com',
// SOCKET_PORT: '',
// MOCK_URL: 'http://8.219.85.124:5000',
NODE_SERVER_PORT: 4201,
GITHUB_ORANIZATION_NAME: variables.GITHUB_ORANIZATION_NAME,
GITHUB_PROJECT_NAME: variables.GITHUB_PROJECT_NAME,
GITHUB_REPO_URL: `https://github.com/${variables.GITHUB_ORANIZATION_NAME}/${variables.GITHUB_PROJECT_NAME}`,
BASE_DOWNLOAD_URL: 'https://data.postcat.com/download/'
// BASE_DOWNLOAD_URL: 'http://127.0.0.1:8080'
} as const;
6 changes: 3 additions & 3 deletions src/platform/node/extension-manager/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class CoreHandler {
if (extensionInfo.main) {
extensionInfo.main = `file://${path.join(extensionInfo.baseDir, extensionInfo.main)}`;
}
if (extensionInfo.node) {
extensionInfo.node = `file://${path.join(extensionInfo.baseDir, extensionInfo.node)}`;
if (extensionInfo.browser) {
extensionInfo.browser = `file://${path.join(extensionInfo.baseDir, extensionInfo.browser)}`;
}
if (extensionInfo.logo?.length > 0 && !extensionInfo.logo.startsWith('http') && !extensionInfo.logo.includes('icon-')) {
extensionInfo.logo = `file://${path.join(extensionInfo.baseDir, extensionInfo.logo)}`;
Expand Down Expand Up @@ -91,6 +91,6 @@ export class CoreHandler {
// @ts-ignore
modules = Object.keys(packageInfo.dependencies || {});
}
return modules;
return modules.filter(val => val);
}
}
2 changes: 1 addition & 1 deletion src/platform/node/extension-manager/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class ModuleHandler extends CoreHandler {
private executeByAppNpm(command: string, modules: any[], resolve, reject) {
// https://www.npmjs.com/package/bin-links
npmCli.load({ 'bin-links': false, verbose: true, prefix: this.baseDir, registry: this.registry }, loaderr => {
const moduleList = modules.map(({ name, version }) => (version ? `${name}@${version}` : name));
const moduleList = modules.filter(val => val).map(({ name, version }) => (version ? `${name}@${version}` : name));
let executeCommand = ['update', 'install', 'uninstall'];
if (!executeCommand.includes(command)) {
return;
Expand Down
5 changes: 3 additions & 2 deletions src/platform/node/extension-manager/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ExtensionInfo, SidebarView, FeatureInfo } from 'eo/workbench/browser/sr
import { createServer } from 'http-server/lib/http-server';
import portfinder from 'portfinder';

import { ELETRON_APP_CONFIG } from '../../../environment';
import { COMMON_APP_CONFIG } from '../../../environment';
import { ModuleHandler } from './handler';
import { ModuleHandlerResult, ModuleManagerInfo } from './handler.model';

Expand Down Expand Up @@ -55,7 +55,7 @@ export class ModuleManager {
async getRemoteExtension(): Promise<ModuleManagerInfo[]> {
return new Promise(resolve => {
let data = '';
https.get(`${ELETRON_APP_CONFIG.EXTENSION_URL}/list`, res => {
https.get(`${COMMON_APP_CONFIG.EXTENSION_URL}/list`, res => {
res.on('data', chunk => {
data += chunk;
});
Expand All @@ -82,6 +82,7 @@ export class ModuleManager {
* @param module
*/
async install(module: ModuleManagerInfo): Promise<ModuleHandlerResult> {
if (!module) return;
const result = await this.moduleHandler.install([module], module?.isLocal || false);
if (result.code === 0) {
const moduleInfo: ExtensionInfo = await this.moduleHandler.info(module.name);
Expand Down
Loading