xiongzhu 2 mesi fa
parent
commit
b65d83a87e
4 ha cambiato i file con 46 aggiunte e 8 eliminazioni
  1. 4 4
      .env
  2. 40 2
      deploy.js
  3. 1 1
      public/index.html
  4. 1 1
      public/version

+ 4 - 4
.env

@@ -1,8 +1,8 @@
 VITE_API_ID=1025907
 VITE_API_HASH=452b0359b988148995f22ff0f4229750
 VITE_VERSION=2.2
-VITE_VERSION_FULL=2.2 (595)
-VITE_BUILD=595
+VITE_VERSION_FULL=2.2 (596)
+VITE_BUILD=596
 VITE_LANG_PACK_VERSION=230736
 VITE_MTPROTO_WORKER=1
 VITE_MTPROTO_SW=
@@ -13,5 +13,5 @@ VITE_MTPROTO_HAS_HTTP=1
 VITE_MTPROTO_HAS_WS=1
 VITE_SAFARI_PROXY_WEBSOCKET=
 PRODUCTION_BUILD_VERSION=2.1.4
-VITE_API_DOMAIN=tc4ug8.cc
-VITE_WEB_DOMAIN=
+VITE_API_DOMAIN=ohgjv.icu
+VITE_WEB_DOMAIN=web.ohgjv.icu

+ 40 - 2
deploy.js

@@ -8,12 +8,16 @@ const domain = /VITE_API_DOMAIN=(?<domain>.*)/.exec(
   fs.readFileSync(".env").toString()
 )?.groups.domain;
 
-if (!domain) {
+const webdomain = /VITE_WEB_DOMAIN=(?<webdomain>.*)/.exec(
+  fs.readFileSync(".env").toString()
+)?.groups.webdomain;
+
+if (!domain || !webdomain) {
   console.log("error domain");
   process.exit(-1);
 }
 
-console.log(domain);
+console.log(domain, webdomain);
 
 function upload(src, dest) {
   console.log(`scp ${src} root@${server}:${dest}`);
@@ -89,6 +93,22 @@ function rsync() {
   });
 }
 
+function build(){
+    return new Promise((resolve, reject) => {
+        const p = childProcess.spawn(`node`, ["build.js"]);
+        p.stdout.on("data", (data) => {
+            console.log(data.toString());
+        });
+        p.stderr.on("data", (data) => {
+            console.error(data.toString());
+        });
+        p.on("exit", (signal) => {
+            if (signal === 0) resolve();
+            else reject(`node build.js exit with code: ${signal}`);
+        });
+    });
+}
+
 const tmpDir = fs.mkdtempSync(os.tmpdir());
 const api_conf_tmp = path.join(tmpDir, "api.conf");
 const [part1, part2] = domain.split(".");
@@ -102,10 +122,28 @@ fs.writeFileSync(
 );
 console.log(api_conf_tmp);
 
+const web_conf_tmp = path.join(tmpDir, "web.conf");
+fs.writeFileSync(
+  web_conf_tmp,
+  fs
+    .readFileSync("nginx_conf/web.conf")
+    .toString()
+    .replace("{webdomain}", webdomain)
+);
+
 upload(api_conf_tmp, "/etc/openresty/conf.d/api.conf")
+  .then(() => {
+    return upload(web_conf_tmp, "/etc/openresty/conf.d/web.conf");
+  })
   .then(() => {
     return exec("openresty -T");
   })
+  .then(() => {
+    return exec("openresty -s reload");
+  })
+  .then(() => {
+    return build();
+  })
   .then(() => {
     return rsync();
   })

+ 1 - 1
public/index.html

@@ -41,7 +41,7 @@
     <link rel="canonical" href="https://web.telegram.org/">
 
     <link rel="manifest" id="manifest">
-    <script type="module" crossorigin src="./index-L1ibCXQs.js"></script>
+    <script type="module" crossorigin src="./index-DH8u4krw.js"></script>
     <link rel="stylesheet" crossorigin href="./index-CK8lo81H.css">
   </head>
   <body class="animation-level-2 has-auth-pages">

+ 1 - 1
public/version

@@ -1 +1 @@
-2.2 (595)
+2.2 (596)