Explorar o código

feat: fetch with https

haitao hai 3 meses
pai
achega
842cf35b32
Modificáronse 4 ficheiros con 31 adicións e 13 borrados
  1. 18 0
      deploy.ps1
  2. 1 1
      rag-server/rag-loaders/test/test.indexes.service.js
  3. 1 1
      src/index.html
  4. 11 11
      src/lib/ncloud.ts

+ 18 - 0
deploy.ps1

@@ -0,0 +1,18 @@
+# 打包项目,携带应用前缀(index.html中相对路径将自动修复为/dev/jxnu/<学号>前缀)
+# /dev/ 项目测试版上传路径
+# /dev/jxnu/<学号> nova-crm项目预留路径
+set NODE_OPTIONS=–max_old_space_size=16000
+node ./node_modules/@angular/cli/bin/ng build --base-href=/dev/jxnu/agent/
+
+# 清空旧文件目录
+obsutil rm obs://nova-cloud/dev/jxnu/agent -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com"
+
+# 同步文件目录
+obsutil sync ./www obs://nova-cloud/dev/jxnu/agent  -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+
+# 授权公开可读
+obsutil chattri obs://nova-cloud/dev/jxnu/agent -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+
+# 列举对象
+obsutil ls obs://nova-cloud/dev/jxnu/agent  -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com"
+

+ 1 - 1
rag-server/rag-loaders/test/test.indexes.service.js

@@ -1,6 +1,6 @@
 let Parse = require('parse/node');
 Parse.initialize("dev");
-Parse.serverURL = "http://dev.fmode.cn:1337/parse";
+Parse.serverURL = "https://dev.fmode.cn/parse";
 Parse.masterKey = "devmk";
 global.Parse = Parse
 

+ 1 - 1
src/index.html

@@ -3,7 +3,7 @@
 
 <head>
   <meta charset="utf-8" />
-  <title>Ionic App</title>
+  <title>飞码AI:智能体开发课程示例</title>
 
   <base href="/" />
 

+ 11 - 11
src/lib/ncloud.ts

@@ -29,7 +29,7 @@ export class CloudObject {
 
     async save() {
         let method = "POST";
-        let url = `http://dev.fmode.cn:1337/parse/classes/${this.className}`;
+        let url = `https://dev.fmode.cn/parse/classes/${this.className}`;
 
         // 更新
         if (this.id) {
@@ -61,7 +61,7 @@ export class CloudObject {
 
     async destroy() {
         if (!this.id) return;
-        const response = await fetch(`http://dev.fmode.cn:1337/parse/classes/${this.className}/${this.id}`, {
+        const response = await fetch(`https://dev.fmode.cn/parse/classes/${this.className}/${this.id}`, {
             headers: {
                 "x-parse-application-id": "dev"
             },
@@ -117,7 +117,7 @@ export class CloudQuery {
     }
 
     async get(id: string) {
-        const url = `http://dev.fmode.cn:1337/parse/classes/${this.className}/${id}?`;
+        const url = `https://dev.fmode.cn/parse/classes/${this.className}/${id}?`;
 
         const response = await fetch(url, {
             headers: {
@@ -135,7 +135,7 @@ export class CloudQuery {
     }
 
     async find():Promise<Array<CloudObject>> {
-        let url = `http://dev.fmode.cn:1337/parse/classes/${this.className}?`;
+        let url = `https://dev.fmode.cn/parse/classes/${this.className}?`;
 
         let queryStr = ``
         Object.keys(this.queryParams).forEach(key=>{
@@ -172,7 +172,7 @@ export class CloudQuery {
 
 
     async first() {
-        let url = `http://dev.fmode.cn:1337/parse/classes/${this.className}?`;
+        let url = `https://dev.fmode.cn/parse/classes/${this.className}?`;
 
         if (Object.keys(this.queryParams["where"]).length) {
             const whereStr = JSON.stringify(this.queryParams["where"]);
@@ -232,7 +232,7 @@ export class CloudUser extends CloudObject {
             return null;
         }
         return this;
-        // const response = await fetch(`http://dev.fmode.cn:1337/parse/users/me`, {
+        // const response = await fetch(`https://dev.fmode.cn/parse/users/me`, {
         //     headers: {
         //         "x-parse-application-id": "dev",
         //         "x-parse-session-token": this.sessionToken // 使用sessionToken进行身份验证
@@ -250,7 +250,7 @@ export class CloudUser extends CloudObject {
 
     /** 登录 */
     async login(username: string, password: string):Promise<CloudUser|null> {
-        const response = await fetch(`http://dev.fmode.cn:1337/parse/login`, {
+        const response = await fetch(`https://dev.fmode.cn/parse/login`, {
             headers: {
                 "x-parse-application-id": "dev",
                 "Content-Type": "application/json"
@@ -282,7 +282,7 @@ export class CloudUser extends CloudObject {
             return;
         }
 
-        const response = await fetch(`http://dev.fmode.cn:1337/parse/logout`, {
+        const response = await fetch(`https://dev.fmode.cn/parse/logout`, {
             headers: {
                 "x-parse-application-id": "dev",
                 "x-parse-session-token": this.sessionToken
@@ -312,7 +312,7 @@ export class CloudUser extends CloudObject {
             ...additionalData // 合并额外的用户数据
         };
 
-        const response = await fetch(`http://dev.fmode.cn:1337/parse/users`, {
+        const response = await fetch(`https://dev.fmode.cn/parse/users`, {
             headers: {
                 "x-parse-application-id": "dev",
                 "Content-Type": "application/json"
@@ -339,7 +339,7 @@ export class CloudUser extends CloudObject {
 
     override async save() {
         let method = "POST";
-        let url = `http://dev.fmode.cn:1337/parse/users`;
+        let url = `https://dev.fmode.cn/parse/users`;
     
         // 更新用户信息
         if (this.id) {
@@ -397,7 +397,7 @@ export class CloudApi{
             reqOpts.body = JSON.stringify(body || options?.body);
             reqOpts.json = true;
         }
-        let host = `http://dev.fmode.cn:1337`
+        let host = `https://dev.fmode.cn`
         // host = `http://127.0.0.1:1337`
         let url = `${host}/api/`+path
         console.log(url,reqOpts)