style: tab -> 2 spaces in all html files
This commit is contained in:
		
							
								
								
									
										1631
									
								
								test/home.html
									
									
									
									
									
								
							
							
						
						
									
										1631
									
								
								test/home.html
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										148
									
								
								test/index.html
									
									
									
									
									
								
							
							
						
						
									
										148
									
								
								test/index.html
									
									
									
									
									
								
							@@ -8,22 +8,17 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="UTF-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
    <title>DevStar Home</title>
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
  <title>DevStar Home</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
    <iframe 
 | 
			
		||||
    id="embedded-devstar"
 | 
			
		||||
    src="http://localhost:8080/test/home.html" 
 | 
			
		||||
    width="100%" 
 | 
			
		||||
    height="100%"
 | 
			
		||||
    frameborder="0"
 | 
			
		||||
  <iframe id="embedded-devstar" src="http://localhost:8080/test/home.html" width="100%" height="100%" frameborder="0"
 | 
			
		||||
    style="border: 0; left: 0; right: 0; bottom: 0; top: 0; position:absolute;">
 | 
			
		||||
    </iframe>
 | 
			
		||||
  </iframe>
 | 
			
		||||
 | 
			
		||||
    <!-- <iframe 
 | 
			
		||||
  <!-- <iframe 
 | 
			
		||||
    id="embedded-devstar"
 | 
			
		||||
    src="https://www.devstar.cn/spa.html" 
 | 
			
		||||
    width="100%" 
 | 
			
		||||
@@ -32,74 +27,75 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
 | 
			
		||||
    style="border: 0; left: 0; right: 0; bottom: 0; top: 0; position:absolute;">
 | 
			
		||||
    </iframe> -->
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
        const vscode = acquireVsCodeApi();
 | 
			
		||||
  <script>
 | 
			
		||||
    const vscode = acquireVsCodeApi();
 | 
			
		||||
 | 
			
		||||
        function firstOpenRemoteFolder() {
 | 
			
		||||
            vscode.postMessage({ command: 'firstOpenRemoteFolder', host: host, username: username, password: password, port: port, path: path });
 | 
			
		||||
    function firstOpenRemoteFolder() {
 | 
			
		||||
      vscode.postMessage({ command: 'firstOpenRemoteFolder', host: host, username: username, password: password, port: port, path: path });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function openRemoteFolder() {
 | 
			
		||||
      vscode.postMessage({ command: 'openRemoteFolder', host: host, path: path });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function firstOpenRemoteFolderWithData(host, username, password, port, path) {
 | 
			
		||||
      vscode.postMessage({ command: 'firstOpenRemoteFolder', host: host, username: username, password: password, port: port, path: path });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function openRemoteFolderWithData(host, path) {
 | 
			
		||||
      vscode.postMessage({ command: 'openRemoteFolder', host: host, path: path });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    async function communicateVSCode(command, data) {
 | 
			
		||||
      return new Promise((resolve, reject) => {
 | 
			
		||||
        // request to vscode 
 | 
			
		||||
        vscode.postMessage({ command: command, data: data })
 | 
			
		||||
 | 
			
		||||
        function handleResponse(event) {
 | 
			
		||||
          const jsonData = event.data;
 | 
			
		||||
          if (jsonData.command === command) {
 | 
			
		||||
            // console.log("communicateVSCode", jsonData.data)
 | 
			
		||||
 | 
			
		||||
            // return vscode response
 | 
			
		||||
            window.removeEventListener('message', handleResponse) // 清理监听器
 | 
			
		||||
            resolve(jsonData.data)
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function openRemoteFolder() {
 | 
			
		||||
            vscode.postMessage({ command: 'openRemoteFolder', host: host, path: path });
 | 
			
		||||
        window.addEventListener('message', handleResponse)
 | 
			
		||||
 | 
			
		||||
        setTimeout(() => {
 | 
			
		||||
          window.removeEventListener('message', handleResponse)
 | 
			
		||||
          reject('timeout')
 | 
			
		||||
        }, 5000); // 5秒超时
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 监听子页面的消息
 | 
			
		||||
    window.addEventListener('message', async (event) => {
 | 
			
		||||
      // 出于安全考虑,检查 event.origin 是否是你预期的源
 | 
			
		||||
      // if (event.origin !== "http://expected-origin.com") {
 | 
			
		||||
      //     return;
 | 
			
		||||
      // }
 | 
			
		||||
      try {
 | 
			
		||||
        const jsonData = event.data;
 | 
			
		||||
 | 
			
		||||
        if (jsonData.target === 'vscode') {
 | 
			
		||||
          const actionFromHome = jsonData.action
 | 
			
		||||
          const dataFromHome = jsonData.data
 | 
			
		||||
          const dataFromVSCodeResponse = await communicateVSCode(actionFromHome, dataFromHome)
 | 
			
		||||
 | 
			
		||||
          var iframe = document.getElementById('embedded-devstar');
 | 
			
		||||
          if (iframe && iframe.contentWindow) {
 | 
			
		||||
            iframe.contentWindow.postMessage({ action: actionFromHome, data: dataFromVSCodeResponse }, '*')
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function firstOpenRemoteFolderWithData(host, username, password, port, path) {
 | 
			
		||||
            vscode.postMessage({ command: 'firstOpenRemoteFolder', host: host, username: username, password: password, port: port, path: path });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function openRemoteFolderWithData(host, path) {
 | 
			
		||||
            vscode.postMessage({ command: 'openRemoteFolder', host: host, path: path });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        async function communicateVSCode(command, data) {
 | 
			
		||||
            return new Promise((resolve, reject) => {
 | 
			
		||||
                // request to vscode 
 | 
			
		||||
                vscode.postMessage({ command: command, data: data })
 | 
			
		||||
 | 
			
		||||
                function handleResponse(event) {
 | 
			
		||||
                    const jsonData = event.data;
 | 
			
		||||
                    if (jsonData.command === command) {
 | 
			
		||||
                        // console.log("communicateVSCode", jsonData.data)
 | 
			
		||||
 | 
			
		||||
                        // return vscode response
 | 
			
		||||
                        window.removeEventListener('message', handleResponse) // 清理监听器
 | 
			
		||||
                        resolve(jsonData.data)
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                window.addEventListener('message', handleResponse)
 | 
			
		||||
 | 
			
		||||
                setTimeout(() => {
 | 
			
		||||
                    window.removeEventListener('message', handleResponse)
 | 
			
		||||
                    reject('timeout')
 | 
			
		||||
                }, 5000); // 5秒超时
 | 
			
		||||
            })
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 监听子页面的消息
 | 
			
		||||
        window.addEventListener('message', async (event) => {
 | 
			
		||||
            // 出于安全考虑,检查 event.origin 是否是你预期的源
 | 
			
		||||
            // if (event.origin !== "http://expected-origin.com") {
 | 
			
		||||
            //     return;
 | 
			
		||||
            // }
 | 
			
		||||
            try {
 | 
			
		||||
                const jsonData = event.data;
 | 
			
		||||
 | 
			
		||||
                if (jsonData.target === 'vscode') {
 | 
			
		||||
                    const actionFromHome = jsonData.action
 | 
			
		||||
                    const dataFromHome = jsonData.data
 | 
			
		||||
                    const dataFromVSCodeResponse = await communicateVSCode(actionFromHome, dataFromHome)
 | 
			
		||||
                    
 | 
			
		||||
                    var iframe = document.getElementById('embedded-devstar');
 | 
			
		||||
                    if(iframe && iframe.contentWindow) {
 | 
			
		||||
                        iframe.contentWindow.postMessage({action: actionFromHome, data: dataFromVSCodeResponse}, '*')
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                console.error('Error parsing message:', error);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error('Error parsing message:', error);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  </script>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user