Skip to content

Commit

Permalink
Merge pull request #436 from hamster-shared/features/v0.18.0
Browse files Browse the repository at this point in the history
Features/v0.18.0
  • Loading branch information
mohaijiang authored Nov 30, 2023
2 parents 0b7718c + 84a3de9 commit 746b7b1
Show file tree
Hide file tree
Showing 100 changed files with 6,971 additions and 1,621 deletions.
10 changes: 7 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ VITE_NODE_ENV=development

VITE_APP_TITLE=Hamster

VITE_APP_CLIENTID="9fce2a15f6df21849e20"
# VITE_APP_CLIENTID="9fce2a15f6df21849e20"
VITE_APP_CLIENTID="Iv1.6d9972fa6afd1c02"
# 02projects 14middleWare
VITE_BASE_API="http://61.172.179.6:30302/api"
# VITE_BASE_API="http://61.172.179.6:30302/api"
VITE_BASE_API="https://develop.hamster.newtouch.com/api"

VITE_WS_API="ws://61.172.179.6:30302/api"

VITE_OAUTH_URL="https://github.com/apps/hamster-test/installations/new"
VITE_HAMSTER_URL="https://develop.hamster.newtouch.com"
# VITE_OAUTH_URL="https://github.com/apps/hamster-test/installations/new"
VITE_OAUTH_URL="https://github.com/apps/hamster-90/installations/select_target"
8 changes: 6 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ VITE_NODE_ENV=production

VITE_APP_TITLE=Hamster

VITE_APP_CLIENTID="a782e08a53e86517dcc5"
# VITE_APP_CLIENTID="a782e08a53e86517dcc5"
VITE_APP_CLIENTID="Iv1.84a628b1689aab9d"

VITE_BASE_API="http://61.172.179.6:30314/api"

VITE_WS_API="wss://develop.alpha.hamsternet.io/api"

VITE_OAUTH_URL="https://github.com/apps/hamster-alpha/installations/new"
VITE_HAMSTER_URL="https://develop.alpha.hamsternet.io"

# VITE_OAUTH_URL="https://github.com/apps/hamster-alpha/installations/new"
VITE_OAUTH_URL="https://github.com/apps/hamster-alpha/installations/select_target"
6 changes: 5 additions & 1 deletion .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ VITE_NODE_ENV=development

VITE_APP_TITLE=Hamster

VITE_APP_CLIENTID="9fce2a15f6df21849e20"
# VITE_APP_CLIENTID="9fce2a15f6df21849e20"
VITE_APP_CLIENTID="Iv1.6d9972fa6afd1c02"

VITE_BASE_API="http://61.172.179.6:30314/api"
# VITE_BASE_API="http://172.16.10.43:8080/api"

VITE_WS_API="wss://develop.hamster.newtouch.com/api"

VITE_HAMSTER_URL="https://develop.hamster.newtouch.com"

VITE_OAUTH_URL="https://github.com/apps/hamster-test/installations/new"
4 changes: 3 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ set -ex;
export PIPELINE_ID=$(date "+%Y%m%d%H%M%S")

# build
yarn build:production
yarn install
#yarn build:staging
node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build --mode staging

#buildx
docker buildx build -t hamstershare/hamster-frontend:${PIPELINE_ID} --platform=linux/amd64 --push .
Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
</head>
<body>
<div id="app"></div>
<script>
// Global node polyfill.
window.global = window;
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@
"@argent/get-starknet": "^5.3.1",
"@better-scroll/core": "^2.5.0",
"@better-scroll/scroll-bar": "^2.5.0",
"@coral-xyz/anchor": "^0.29.0",
"@metaplex-foundation/mpl-token-metadata": "^3.1.0",
"@metaplex-foundation/umi": "^0.8.10",
"@metaplex-foundation/umi-bundle-defaults": "^0.8.10",
"@metaplex-foundation/umi-signer-wallet-adapters": "^0.8.10",
"@cfx-kit/wallet-avatar": "0.0.5",
"@mysten/sui.js": "^0.31.0",
"@mysten/wallet-adapter-wallet-standard": "^0.7.1",
"@openzeppelin/contracts": "^4.8.1",
"@openzeppelin/contracts-upgradeable": "^4.8.1",
"@openzeppelin/wizard": "^0.2.0",
"@rollup/plugin-inject": "^5.0.5",
"@solana/spl-token": "^0.3.8",
"@solana/wallet-adapter-wallets": "^0.19.23",
"@solana/web3.js": "^1.87.5",
"@vueuse/core": "^9.13.0",
"@web3-onboard/core": "^2.16.0",
"@web3-onboard/injected-wallets": "^2.4.0",
Expand All @@ -33,18 +43,24 @@
"date-fns-tz": "^2.0.0",
"dayjs": "^1.11.6",
"echarts": "^5.4.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
"eth-crypto": "^2.6.0",
"ethers": "^5.7.2",
"https-browserify": "^1.0.0",
"ic0": "^0.2.7",
"md-editor-v3": "^2.7.2",
"monaco-editor": "^0.34.1",
"near-api-js": "^2.1.4",
"openai": "^3.1.0",
"petra-plugin-wallet-adapter": "^0.1.3",
"pinia": "^2.0.23",
"prismjs": "^1.29.0",
"qrcode.vue": "^3.4.0",
"rpc-websockets": "^7.5.1",
"socket.io-client": "^2.3.1",
"solana-wallets-vue": "^0.6.0",
"starknet": "^4.21.0",
"stream-http": "^3.2.0",
"uuid": "^9.0.1",
"vue": "^3.2.41",
"vue-fullscreen": "^3.1.1",
Expand All @@ -67,7 +83,9 @@
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.0",
"@vue/tsconfig": "^0.1.3",
"assert": "^2.1.0",
"autoprefixer": "^10.4.13",
"crypto-browserify": "^3.12.0",
"eslint": "^8.22.0",
"eslint-plugin-vue": "^9.3.0",
"jest": "^29.3.1",
Expand All @@ -80,6 +98,7 @@
"tailwindcss": "^3.2.3",
"ts-jest": "^29.1.0",
"typescript": "~4.7.4",
"util": "^0.12.5",
"vite": "^3.1.8",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-prismjs": "^0.0.8",
Expand Down
90 changes: 89 additions & 1 deletion src/apis/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import httpRequest from "@/request";

interface AddLoginParams {
code: string,
clientId: string,
// clientId: string,
}

// login
Expand Down Expand Up @@ -47,3 +47,91 @@ export function saveWallet(address:string) {
data: {address: address},
});
}


// 获取安装install的信息
export function getInstallations() {
return httpRequest({
url: "/api/github/users/installations",
method: "get",
});
}

// 获取github仓库列表
// export function getInstallationsRepositories(id:string) {
// return httpRequest({
// url: `/api/github/installations/${id}/repositories`,
// method: "get",
// data: {id: id}
// });
// }

// 获取github仓库的权限 all --->不展示调整权限
// selected ------>展示调整权限字样
export function getGithubSelection(id:string) {
return httpRequest({
url: `/api/repository/selection`,
method: "get",
data: {id: id}
});
}

// install github app
export function installGithubApp() {
return httpRequest({
url: `/api/repository/selection`,
method: "post",
});
}

// 钱包登录下需要install情况下github auth
export function githubInstallAuth(params:any) {
return httpRequest({
url: `/api/github/install/auth`,
method: "post",
data: params,
});
}

// 获取用户是否install GitHub app github/install
export function githubInstallCheck() {
return httpRequest({
url: `/api/github/install/check`,
method: "get",
});
}

// 获取用户信息
export function getUserInfo() {
return httpRequest({
url: `/api/v2/user`,
method: "get",
});
}


// metaMask登录用户信息 /api/github/user/:id
export function getUserInfoById(id:string) {
return httpRequest({
url: `/api/github/user/${id}`,
method: "get",
});
}

// metamask钱包登录
export function metamaskLogin(data:any) {
return httpRequest({
url: `/api/metamask/login`,
method: "post",
data:{address:data.address}
});
}

// github登录
export function login(params: AddLoginParams) {
return httpRequest({
url: `/api/v2/login`,
method: "post",
data: params,
});
}
122 changes: 122 additions & 0 deletions src/apis/middlewareRPC.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import httpRequest from "@/request";

// 用户是否已经进行了zan授权
export function apiGetZanUserAuthed() {
return httpRequest({
url: '/api/v2/zan/account/authed',
method: "get",
});
}

// 获取zan授权链接接口
export function apiGetZanAuthUrl() {
return httpRequest({
url: '/api/v2/zan/account/auth_url',
method: "get",
});
}

// 交换zan的 access_token
export function apiZanExchangeAccessToken(autoCode: string) {
return httpRequest({
url: '/api/v2/zan/account/access_token',
method: "post",
data: {
authCode: autoCode
}
});
}

// 套餐信息查询接口
export function apiZanPlan() {
return httpRequest({
url: '/api/v2/zan/node-service/plan',
method: "get"
});
}

// API KEY 分页查询接口
export function apiZanApiKeyPage(page: number, size: number) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/list?page=${page}&size=${size}`,
method: "get"
});
}

export function apiZanApiKeyCreditCostLast24() {
return apiZanApiKeyPage(1, 100).then(resp => {
// @ts-ignore
let apiKeys = resp.data.data.map((t: string) => t.apiKeyId)
return Promise.all(apiKeys.map((t: string) => apiZanApiKeyCreditCost(t)))
}).then(datas => {
return datas.map((t: any) => t.data).reduce((a, b) => a.concat(b), [])
})
}

// API KEY credit cost 统计查询接口
export function apiZanApiKeyCreditCost(apiKey: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/stats/credit-cost?apiKeyId=${apiKey}`,
method: "get"
});
}

// API Key request 统计查询接口
export function apiZanApiKeyRequestStats(apiKey: string, timeInterval: string, ecosystem: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/stats/requests?apiKeyId=${apiKey}&timeInterval=${timeInterval}&ecosystem=${ecosystem}`,
method: "get"
});
}

// 创建API KEY 接口
export function apiZanCreateApiKey(name: string) {
return httpRequest({
url: '/api/v2/zan/node-service/api-keys',
method: "post",
data: {
name: name
}
});
}

// API KEY 接口详情
export function apiZanApiKeyDetail(apiKeyId: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/detail?apiKeyId=${apiKeyId}`,
method: "get"
});
}

// API KEY request activity 统计查询接口
export function apiZanApiKeyRequestActivityStats(apiKeyId: string, timeInterval: string, ecosystem: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/stats/requests-activity?apiKeyId=${apiKeyId}&timeInterval=${timeInterval}&ecosystem=${ecosystem}`,
method: "get"
});
}

export function apiZanApiKeyRequestActivityStatsFail(apiKeyId: string, timeInterval: string, ecosystem: string, method: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/stats/requests-activity/failed?apiKeyId=${apiKeyId}&timeInterval=${timeInterval}&ecosystem=${ecosystem}&method=${method}`,
method: "get"
});
}

// API KEY request Origin 统计查询接口
export function apiZanApiKeyRequestOriginStats(apiKeyId: string, timeInterval: string) {
return httpRequest({
url: `/api/v2/zan/node-service/api-keys/stats/requests-origin?apiKeyId=${apiKeyId}&timeInterval=${timeInterval}`,
method: "get"
});
}



// 链生态摘要信息查询接口
export function apiZanEcosystemsDigest() {
return httpRequest({
url: `/api/v2/zan/node-service/ecosystems/digest`,
method: "get"
});
}
Loading

0 comments on commit 746b7b1

Please sign in to comment.