Skip to content

Commit

Permalink
feat: API Authorization (#251)
Browse files Browse the repository at this point in the history
* feat: API Authorization

* fix: API Group flow

* perf(api-group): group select status

* build(e2e): delete image

---------

Co-authored-by: buqiyuan <1743369777@qq.com>
  • Loading branch information
scarqin and buqiyuan committed Mar 14, 2023
1 parent bf7694d commit ddf7292
Show file tree
Hide file tree
Showing 525 changed files with 16,206 additions and 10,293 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
_cli-tpl/
dist/
coverage/
src/node

# Logs
logs
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ out/
/release
*.js
*.js.map
*.webpack.js
!patches/*
!src/workbench/node/electron/**/*.js
!src/workbench/node/request/**/*.js
!src/workbench/node/server/**/*.js
!src/node/**/*.js
!/api/*.js
!/scripts/**/*.js
!*.config.js
Expand Down
1,218 changes: 484 additions & 734 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ yarn start

```shell

cd src/workbench/browser&&npm install
cd src/browser&&npm install

yarn start

Expand Down
14 changes: 7 additions & 7 deletions api/unit.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
let _LibsFlowCommon = require('../src/workbench/node/request/unit.js');
let _LibsCommon = require('../src/workbench/node/request/libs/common.js');
let _LibsFlowCommon = require('../src/node/test-server/request/unit.js');
let _LibsCommon = require('../src/node/test-server/request/libs/common.js');

module.exports = (req, res) => {
console.log('unit.js', req.body);
try {
let reqJSON = req.body.data;
reqJSON.env = _LibsCommon.parseEnv(reqJSON.env);
new _LibsFlowCommon.core().main(reqJSON).then(({ globals,report, history }) => {
['general', 'requestInfo', 'resultInfo'].forEach((keyName) => {
new _LibsFlowCommon.core().main(reqJSON).then(({ globals, report, history }) => {
['general', 'requestInfo', 'resultInfo'].forEach(keyName => {
if (typeof history[keyName] === 'string') history[keyName] = JSON.parse(history[keyName]);
});
res.send(
JSON.stringify({
action: 'finish',
data: {
id: req.body.id,
globals:globals,
globals: globals,
report: report,
history: history,
},
history: history
}
})
);
});
Expand Down
4 changes: 2 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
files:
- source: /src/workbench/browser/src/locale/messages.xlf
translation: /src/workbench/browser/src/locale/messages.%two_letters_code%.xlf
- source: /src/browser/src/locale/messages.xlf
translation: /src/browser/src/locale/messages.%two_letters_code%.xlf
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
2 changes: 1 addition & 1 deletion donkey.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const baseUrl = './src/workbench/browser/src/app/shared/services/storage/';
const baseUrl = './src/browser/src/app/shared/services/storage/';
module.exports = {
entry: {
// target: ["./test/apiData.ts", "./test/env.ts"]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "postcat",
"version": "0.3.2",
"version": "0.4.0",
"main": "out/app/electron-main/main.js",
"description": "A lightweight, extensible API tool",
"homepage": "https://github.com/Postcatlab/postcat.git",
"author": "Postcat",
"private": true,
"workspaces": [
"src/workbench/*"
"src/node/*",
"src/browser"
],
"scripts": {
"prepare": "husky install && electron-builder install-app-deps && node ./scripts/afterInstall.js && npx patch-package",
Expand Down Expand Up @@ -108,7 +109,7 @@
},
"__npminstall_done": false,
"node-module-alias": {
"eo": "./out"
"pc": "./out"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const config: Configuration = {
'out/platform/**/*.js*',
'out/environment.js',
'out/shared/**/*.js*',
'src/workbench/browser/dist/**/*',
'out/workbench/browser/src/**/*.js*',
'out/workbench/node/**/*.js*',
'src/browser/dist/**/*',
'out/browser/src/**/*.js*',
'out/node/test-server/**/*.js*',
'out/app/common/**/*',
'!**/*.ts'
],
Expand Down
6 changes: 3 additions & 3 deletions scripts/buildNoSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ const config: Configuration = {
'out/platform/**/*.js*',
'out/environment.js',
'out/shared/**/*.js*',
'src/workbench/browser/dist/**/*',
'out/workbench/browser/src/**/*.js*',
'out/workbench/node/**/*.js*',
'src/browser/dist/**/*',
'out/browser/src/**/*.js*',
'out/node/test-server/**/*.js*',
'out/app/common/**/*',
'!**/*.ts'
],
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools/replaceCssVariable.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const variables = {
'--MARGIN': '--margin',
'--MR_ICON': '--button-icon-margin'
};
searchFilesInDirectoryAsync(['../src/workbench/browser/src'], sortByKeylength(variables));
searchFilesInDirectoryAsync(['../src/browser/src'], sortByKeylength(variables));
//Lazy to await
setTimeout(() => {
console.log('Replaced Success!\n', replaceSuccess);
Expand Down
4 changes: 2 additions & 2 deletions scripts/tools/upgradeComponent.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//If stuck,check yarn.lock file,maybe has conflict
// upgrade.js
const child_process = require('child_process');
const pkg = require('../src/workbench/browser/package.json');
const pkg = require('../../src/browser/package.json');
const filterRegex = /eo-ng-.*/;

const dependencies = pkg['dependencies'];
const dependencyList = Object.keys(dependencies).filter(dependency => filterRegex.test(dependency));
child_process.execSync(`cd ../src/workbench/browser&&yarn upgrade ${dependencyList.join('@latest ')}@latest`);
child_process.execSync(`cd ../../src/browser&&yarn upgrade ${dependencyList.join('@latest ')}@latest`);
2 changes: 1 addition & 1 deletion src/app/electron-main/language.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { app } from 'electron';
import Store from 'electron-store';

import { LANGUAGES } from '../../workbench/browser/src/app/core/services/language/language.model';
import { LANGUAGES } from '../../browser/src/app/core/services/language/language.model';
const store = new Store();
class LanguageInstance {
private static _instance: LanguageInstance;
Expand Down
10 changes: 5 additions & 5 deletions src/app/electron-main/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require('@bqy/node-module-alias/register');
import { app, BrowserWindow, ipcMain } from 'electron';
import Store from 'electron-store';
import { LanguageService } from 'eo/app/electron-main/language.service';
import { MockServer } from 'eo/platform/node/mock-server';
import { LanguageService } from 'pc/app/electron-main/language.service';
import { MockServer } from 'pc/platform/node/mock-server';
import portfinder from 'portfinder';

import { UnitWorkerModule } from '../../node/test-server/electron/main';
import socket from '../../node/test-server/server/socketio';
import { processEnv } from '../../platform/node/constant';
import { ModuleManager } from '../../platform/node/extension-manager/manager';
import { proxyOpenExternal } from '../../shared/common/browserView';
import { UnitWorkerModule } from '../../workbench/node/electron/main';
import socket from '../../workbench/node/server/socketio';
import { EoUpdater } from './updater';

import * as os from 'os';
Expand Down Expand Up @@ -98,7 +98,7 @@ class EoBrowserWindow {
const file: string =
processEnv === 'development'
? 'http://localhost:4200'
: `file://${path.join(__dirname, `../../../src/workbench/browser/dist/${await LanguageService.getPath()}/index.html`)}`;
: `file://${path.join(__dirname, `../../../src/browser/dist/${await LanguageService.getPath()}/index.html`)}`;
this.win.loadURL(file);
if (['development'].includes(processEnv)) {
this.win.webContents.openDevTools({
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/workbench/browser/.gitignore → src/browser/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ src/**/*.js
!src/karma.conf.js
!src/assets/font/*.js
!src/assets/libs/*.js
!build/*.js
*.js.map

!*.webpack.js

# dependencies
node_modules
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"src/icon.ico",
"src/assets",
"src/extensions",
{ "glob": "**/*", "input": "../../../node_modules/monaco-editor/min/vs", "output": "/assets/vs/" }
{ "glob": "**/*", "input": "../../node_modules/monaco-editor/min/vs", "output": "/assets/vs/" }
],
"styles": ["src/styles/antd.less", "src/styles.scss"],
"scripts": ["src/assets/libs/protocolcheck.js"],
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ddf7292

Please sign in to comment.