浏览代码

Added a replaceable variable for the device type in index.html

zinobias 2 年之前
父节点
当前提交
395ad534b1
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 3 1
      .github/workflows/build_and_deploy_ext2_img.yml
  2. 2 2
      index.html

+ 3 - 1
.github/workflows/build_and_deploy_ext2_img.yml

@@ -121,15 +121,17 @@ jobs:
       # Move required files for gh-pages deployment to the deployment directory $DEPLOY_DIR.
       - run: sudo mv assets examples tun xterm favicon.ico index.html login.html network.js scrollbar.css serviceWorker.js tower.ico $DEPLOY_DIR
       
-      # This step updates the default index.html file by performing the following steps:
+      # This step updates the default index.html file by performing the following actions:
       #   1. Replaces all occurrences of UID, GID, and CX_VERSION with their respective input parameters.
       #   2. Replaces all occurrences of IMAGE_URL with the URL to the image.
+      #   3. Replaces all occurrences of DEVICE_TYPE to bytes.
       - name: Adjust index.html
         run: |
           sudo sed -i 's#UID#"${{ github.event.inputs.LOGIN_UID }}"#g' ${{ env.DEPLOY_DIR }}index.html
           sudo sed -i 's#GID#"${{ github.event.inputs.LOGIN_GID }}"#g' ${{ env.DEPLOY_DIR }}index.html
           sudo sed -i 's#CX_VERSION#${{ github.event.inputs.CX_VERSION }}#g' ${{ env.DEPLOY_DIR }}index.html
           sudo sed -i 's#IMAGE_URL#"${{ env.IMAGE_NAME }}"#g' ${{ env.DEPLOY_DIR }}index.html
+          sudo sed -i 's#DEVICE_TYPE#"bytes"#g' ${{ env.DEPLOY_DIR }}index.html
 
       # We generate index.list files for our httpfs to function properly.
       - name: make index.list

+ 2 - 2
index.html

@@ -264,8 +264,8 @@
 		{
 			printOnTerm.printError(printOnTerm.getErrorMessage(err));
 		}
-			// The variable IMAGE_URL is replaced by Github Actions.
-			CheerpXApp.create({devices:[{type:"bytes",url:IMAGE_URL,name:"block1"}],mounts:[{type:"ext2",dev:"block1",path:"/"},{type:"cheerpOS",dev:"/app",path:"/app"},{type:"cheerpOS",dev:"/str",path:"/data"},{type:"devs",dev:"",path:"/dev"}], networkInterface}).then(runTest, failCallback);
+			// The variables IMAGE_URL and DEVICE_TYPE are replaced by Github Actions.
+			CheerpXApp.create({devices:[{type:DEVICE_TYPE,url:IMAGE_URL,name:"block1"}],mounts:[{type:"ext2",dev:"block1",path:"/"},{type:"cheerpOS",dev:"/app",path:"/app"},{type:"cheerpOS",dev:"/str",path:"/data"},{type:"devs",dev:"",path:"/dev"}], networkInterface}).then(runTest, failCallback);
 	}
 	function initialMessage()
 	{