Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ A Web terminal based on SpringBoot Websocket
- [x] optimize code
- [x] resize window
- [x] support window system
- [x] Replace spring with netty (@see netty-impl)
- [ ] idle check
- [ ] terminal management

## Run

### Running from source
JDK 11 or later

#### Netty-impl
```bash
// todo
# open browser http://localhost:8080/
```
![browser.png](./docs/images/img.png)


#### Spring-Websocket-impl
```bash
git clone [email protected]:icankeep/web-terminal.git
cd web-terminal
Expand Down
69 changes: 6 additions & 63 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<modules>
<module>netty-impl</module>
<module>spring-websocket-impl</module>
</modules>
<packaging>pom</packaging>
<groupId>com.passer.demo</groupId>
<artifactId>web-terminal</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>web-terminal</name>
<description>demo of spring websocket</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>

<dependency>
<groupId>org.jetbrains.pty4j</groupId>
<artifactId>pty4j</artifactId>
<version>0.12.5</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>aliyun-repository</id>
<name>aliyun repository</name>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

</project>
65 changes: 65 additions & 0 deletions web-terminal-netty-impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.passer.demo</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>web-terminal-netty-impl</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.85.Final</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.jetbrains.pty4j</groupId>
<artifactId>pty4j</artifactId>
<version>0.12.5</version>
</dependency>
</dependencies>

<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <version>2.4.2</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.passer.demo.nettyimpl;

import com.passer.demo.nettyimpl.handler.TerminalServer;

/**
* @author passer
* @time 2022/12/4 17:09
*/
public class Server {
public static void main(String[] args) {
TerminalServer terminalServer = new TerminalServer();
terminalServer.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.passer.demo.nettyimpl.constant;

/**
* @author passer
* @time 2022/11/26 17:17
*/
public enum MessageTypeEnum {
OPEN, RESIZE, TERMINAL_INPUT, TERMINAL_OUTPUT, CLOSE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.passer.demo.nettyimpl.domain;

import com.passer.demo.nettyimpl.constant.MessageTypeEnum;

/**
* @author passer
* @time 2022/11/20 18:20
*/
public class Message {
private MessageTypeEnum type;
private String data;

public Message() {
}

public Message(MessageTypeEnum type, String data) {
this.type = type;
this.data = data;
}

public MessageTypeEnum getType() {
return type;
}

public void setType(MessageTypeEnum type) {
this.type = type;
}

public String getData() {
return data;
}

public void setData(String data) {
this.data = data;
}

@Override
public String toString() {
return "Message{" +
"type=" + type +
", data='" + data + '\'' +
'}';
}
}
Loading