Skip to content

Commit 1f393a5

Browse files
committed
refactor: always share but control write
1 parent 15a7641 commit 1f393a5

File tree

12 files changed

+93
-455
lines changed

12 files changed

+93
-455
lines changed

README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,14 @@ After you exec some commands, you will see the inputs and outputs under the
130130

131131
### Real-time sharing
132132

133-
```bash
134-
docker run -dti --restart always --name container-web-tty \
135-
-p 8080:8080 \
136-
-e WEB_TTY_SHARE=true \
137-
-v /var/run/docker.sock:/var/run/docker.sock \
138-
wrfly/container-web-tty
139-
```
140-
141-
By enabling this feature, you can share the container's inputs and outputs
142-
with others via the share link (click the container's image to get the link).
133+
You can always share the container's inputs and outputs with others via the exec
134+
link, just share the `/exec/<exec-ID>` to them!
143135

144-
#### Collaborate
136+
### Collaborate
145137

146138
```bash
147139
docker run -dti --restart always --name container-web-tty \
148140
-p 8080:8080 \
149-
-e WEB_TTY_SHARE=true \
150141
-e WEB_TTY_COLLABORATE=true \
151142
-v /var/run/docker.sock:/var/run/docker.sock \
152143
wrfly/container-web-tty
@@ -155,7 +146,7 @@ docker run -dti --restart always --name container-web-tty \
155146
By enabling this feature, once you exec into the container, you can share your
156147
process with others, that means anyone got the shareable link would type the command
157148
to the tty you are working on. You can edit the same file, type the same code, in the
158-
same TTY! (P.S. Only the first exec process would be shared to others)
149+
same TTY! Just share the exec link to your friend!
159150

160151
## Options
161152

@@ -172,8 +163,7 @@ GLOBAL OPTIONS:
172163
--docker-host value docker host path (default: "/var/run/docker.sock")
173164
--docker-ps value docker ps options
174165
--enable-audit, --audit enable audit the container outputs (default: false)
175-
--enable-collaborate, --clb shared terminal can write to the same TTY (default: false)
176-
--enable-share, --share enable share the container's terminal (default: false)
166+
--enable-collaborate, --clb collaborate on the same TTY process (default: false)
177167
--grpc-auth value grpc auth token (default: "password")
178168
--grpc-port value grpc server port, -1 for disable the grpc server (default: -1)
179169
--grpc-proxy value grpc proxy address, in the format of http://127.0.0.1:8080 or socks5://127.0.0.1:1080

config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ type ServerConfig struct {
5151
WSOrigin string
5252
Term string `default:"xterm"`
5353
ShowLocation bool
54-
EnableShare bool
55-
Collaborate bool
54+
Collaborate bool
5655

5756
// audit
5857
EnableAudit bool

main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ func main() {
128128
Usage: "enable container restart",
129129
Destination: &conf.Server.Control.Restart,
130130
},
131-
&cli.BoolFlag{
132-
Name: "enable-share",
133-
Aliases: []string{"share"},
134-
EnvVars: util.EnvVars("share"),
135-
Usage: "enable share the container's terminal",
136-
Destination: &conf.Server.EnableShare,
137-
},
138131
&cli.BoolFlag{
139132
Name: "enable-collaborate",
140133
Aliases: []string{"clb"},

resources/clipboard.min.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

resources/list.html

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<title>{{ .title }}</title>
77
<link rel="icon" type="image/png" href="/favicon.png">
88
<link rel="stylesheet" href="/css/list.css" />
9-
<script src="/js/clipboard.min.js"></script>
109
</head>
1110

1211
<body>
@@ -40,15 +39,7 @@
4039
<td class="column1" title="exec into container">
4140
<a href="/e/{{ printf "%.12s" .ID }}" value="{{ .ID }}" target="_blank">{{ printf "%.12s" .ID }}</a>
4241
</td>
43-
{{- if $share -}}
44-
<td class="column2" title="{{ .Image }} | share tty">
45-
<a href="#" class="copy" data-clipboard-text="/share/{{ printf "%.12s" .ID }}">{{ printf .Image }}</a>
46-
</td>
47-
{{- else -}}
48-
<td class="column2" title="{{ .Image }}">
49-
{{ printf .Image }}
50-
</td>
51-
{{- end -}}
42+
<td class="column2" title="{{ .Image }}">{{ printf .Image }}</td>
5243
<td class="column3" title="{{ .Command }}">{{ printf .Command }}</td>
5344
<td class="column4" title="{{ .Name }}">
5445
<a href="/logs/{{ printf "%.12s" .ID }}?follow=1&tail=10" target="_blank" title="get logs">{{ printf .Name }}</a>
@@ -74,21 +65,6 @@
7465
</div>
7566

7667
<script src="/js/control.js"></script>
77-
<script>
78-
var clipboard = new ClipboardJS('.copy', {
79-
text: function (trigger) {
80-
return trigger.baseURI.replace('/#','') + trigger.getAttribute('data-clipboard-text');
81-
}
82-
});
83-
clipboard.on('success', function (e) {
84-
console.info('Action:', e.action);
85-
console.info('Text:', e.text);
86-
console.info('Trigger:', e.trigger);
87-
88-
e.clearSelection();
89-
alert("share link ("+e.text+") copied!");
90-
});
91-
</script>
9268
</body>
9369

9470
</html>

0 commit comments

Comments
 (0)