Skip to content

Commit

Permalink
v2.15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dooy committed Feb 12, 2024
1 parent 9177a85 commit 2c75749
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changlog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 功能升级日志

# 计划
# 2.15.4
- 🐞 修复:mj 上传文件 服务端授权认证( vercel 暂不支持) #157
# 2.15.3
- 🐞 修复:服务端授权认证( vercel 暂不支持) #138

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chatgpt-web-midjourney-proxy",
"version": "2.15.3",
"version": "2.15.4",
"private": false,
"description": "ChatGPT Web Midjourney Proxy",
"author": "Dooy <[email protected]>",
Expand Down
4 changes: 3 additions & 1 deletion src/api/mjapi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

//import { useChat } from '@/views/chat/hooks/useChat'

import { gptConfigStore, gptServerStore, homeStore } from "@/store";
import { gptConfigStore, gptServerStore, homeStore, useAuthStore } from "@/store";
import { copyToClip } from "@/utils/copy";
import { isNumber } from "@/utils/is";
import { localGet, localSaveAny } from "./mjsave";
Expand Down Expand Up @@ -130,6 +130,8 @@ export const myTrim = (str: string, delimiter: string)=>{

function getHeaderApiSecret(){
if(!gptServerStore.myData.MJ_API_SECRET){
const authStore = useAuthStore()
if( authStore.token ) return { 'x-ptoken': authStore.token };
return {}
}
return {
Expand Down
11 changes: 10 additions & 1 deletion src/api/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ export const GptUploader = ( url:string, FormData:FormData )=>{



if(gptServerStore.myData.OPENAI_API_BASE_URL && url.indexOf(gptServerStore.myData.OPENAI_API_BASE_URL)>-1 ) headers={...headers,...getHeaderAuthorization()}
if(gptServerStore.myData.OPENAI_API_BASE_URL && url.indexOf(gptServerStore.myData.OPENAI_API_BASE_URL)>-1 ) {
headers={...headers,...getHeaderAuthorization()}
//mlog("headers", headers );
}else{
const authStore = useAuthStore()
if( authStore.token ) {
const header2={ 'x-ptoken': authStore.token };
headers= {...headers, ...header2}
}
}
return new Promise<any>((resolve, reject) => {
axios.post( url , FormData, {
headers
Expand Down

0 comments on commit 2c75749

Please sign in to comment.