freerdp-tk 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- freerdp_tk/__init__.py +8 -0
- freerdp_tk/__main__.py +3 -0
- freerdp_tk/app.py +560 -0
- freerdp_tk-0.1.0.dist-info/METADATA +94 -0
- freerdp_tk-0.1.0.dist-info/RECORD +8 -0
- freerdp_tk-0.1.0.dist-info/WHEEL +4 -0
- freerdp_tk-0.1.0.dist-info/entry_points.txt +2 -0
- freerdp_tk-0.1.0.dist-info/licenses/LICENSE +202 -0
freerdp_tk/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""freerdp-tk: a small cross-platform Tkinter launcher for the FreeRDP clients."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version("freerdp-tk")
|
|
7
|
+
except PackageNotFoundError: # running from a source checkout
|
|
8
|
+
__version__ = "0.0.0"
|
freerdp_tk/__main__.py
ADDED
freerdp_tk/app.py
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
"""The freerdp-tk window: a small Tkinter launcher for the FreeRDP command-line clients.
|
|
2
|
+
|
|
3
|
+
Runs on Linux, Windows and macOS with nothing but the Python standard library.
|
|
4
|
+
It keeps a list of saved connections (never passwords), builds a FreeRDP
|
|
5
|
+
command line from a form and shows each client's output in a log pane.
|
|
6
|
+
|
|
7
|
+
The "(auto)" client picks the best client found, preferring the SDL client.
|
|
8
|
+
On FreeRDP 3 the arguments are piped in with /args-from:stdin, so the
|
|
9
|
+
password never shows up in the process list. FreeRDP 2 has no such option
|
|
10
|
+
and gets /p:<password> on the command line instead.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
import queue
|
|
16
|
+
import re
|
|
17
|
+
import shlex
|
|
18
|
+
import shutil
|
|
19
|
+
import subprocess
|
|
20
|
+
import sys
|
|
21
|
+
import threading
|
|
22
|
+
import tkinter as tk
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from tkinter import filedialog, messagebox, simpledialog, ttk
|
|
25
|
+
|
|
26
|
+
APP = "freerdp-tk"
|
|
27
|
+
IS_WIN = sys.platform == "win32"
|
|
28
|
+
IS_MAC = sys.platform == "darwin"
|
|
29
|
+
EXE = ".exe" if IS_WIN else ""
|
|
30
|
+
AUTO = "(auto: prefer SDL)"
|
|
31
|
+
|
|
32
|
+
# Client flavours, best first. The SDL client is the actively developed,
|
|
33
|
+
# cross-platform one, so it wins whenever it is available.
|
|
34
|
+
KINDS = ["sdl3", "sdl", "sdl2", "x11", "wayland", "windows", "other"]
|
|
35
|
+
CLIENT_NAMES = ["sdl-freerdp3", "sdl3-freerdp3", "sdl3-freerdp", "sdl-freerdp", "sdl2-freerdp3",
|
|
36
|
+
"sdl2-freerdp", "xfreerdp3", "xfreerdp", "wlfreerdp3", "wlfreerdp", "wfreerdp"]
|
|
37
|
+
BUILD_GLOBS = ["client/SDL/SDL3/*freerdp*", "client/SDL/SDL2/*freerdp*", "client/X11/xfreerdp*",
|
|
38
|
+
"client/Wayland/wlfreerdp*", "client/Windows/wfreerdp*"]
|
|
39
|
+
GFX_CHOICES = ["(default)", "off", "AVC444", "AVC420", "RFX", "progressive", "AV1:i444",
|
|
40
|
+
"AV1:i420"]
|
|
41
|
+
CERT_CHOICES = ["tofu", "ignore", "deny"]
|
|
42
|
+
LOG_LEVELS = ["(default)", "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"]
|
|
43
|
+
HIDDEN = "********"
|
|
44
|
+
|
|
45
|
+
FIELDS = { # name -> default; everything a saved connection stores
|
|
46
|
+
"client": AUTO, "host": "", "port": "", "user": "", "domain": "", "gateway": "",
|
|
47
|
+
"cert": "tofu", "fullscreen": False, "size": "1600x900", "dynamic": True,
|
|
48
|
+
"multimon": False, "gfx": "(default)", "clipboard": True, "sound": True,
|
|
49
|
+
"microphone": False, "home_drive": False, "drive": "", "log_level": "(default)",
|
|
50
|
+
"extra": "",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def config_dir() -> Path:
|
|
55
|
+
if IS_WIN:
|
|
56
|
+
base = Path(os.environ.get("APPDATA", Path.home()))
|
|
57
|
+
elif IS_MAC:
|
|
58
|
+
base = Path.home() / "Library" / "Application Support"
|
|
59
|
+
else:
|
|
60
|
+
base = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
61
|
+
return base / APP
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def client_kind(path: str) -> str:
|
|
65
|
+
name = Path(path).name.lower()
|
|
66
|
+
for kind, marker in (("sdl3", "sdl3"), ("sdl2", "sdl2"), ("sdl", "sdl"), ("x11", "xfreerdp"),
|
|
67
|
+
("wayland", "wlfreerdp"), ("windows", "wfreerdp")):
|
|
68
|
+
if marker in name:
|
|
69
|
+
return kind
|
|
70
|
+
return "other"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def find_clients() -> list[str]:
|
|
74
|
+
"""Clients on PATH and in local FreeRDP build trees, best first.
|
|
75
|
+
|
|
76
|
+
Build trees are searched in ~/projects/FreeRDP and in every source tree
|
|
77
|
+
listed in $FREERDP_TK_TREES (separated like PATH).
|
|
78
|
+
"""
|
|
79
|
+
found = [p for p in (shutil.which(n) for n in CLIENT_NAMES) if p]
|
|
80
|
+
trees = [Path.home() / "projects" / "FreeRDP"]
|
|
81
|
+
extra = os.environ.get("FREERDP_TK_TREES", "").split(os.pathsep)
|
|
82
|
+
trees += [Path(t).expanduser() for t in extra if t]
|
|
83
|
+
for tree in dict.fromkeys(trees):
|
|
84
|
+
for build in sorted(tree.glob("build*")):
|
|
85
|
+
for pattern in BUILD_GLOBS:
|
|
86
|
+
for path in sorted(build.glob(pattern)):
|
|
87
|
+
if path.is_file() and os.access(path, os.X_OK) and path.suffix in ("", EXE):
|
|
88
|
+
found.append(str(path))
|
|
89
|
+
unique = list(dict.fromkeys(found))
|
|
90
|
+
return sorted(unique, key=lambda p: KINDS.index(client_kind(p))) # stable: PATH first
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def client_major_version(client: str) -> int:
|
|
94
|
+
"""Major FreeRDP version of a client, 0 when it cannot be told."""
|
|
95
|
+
try:
|
|
96
|
+
out = subprocess.run([client, "/version"], capture_output=True, text=True, timeout=5,
|
|
97
|
+
**no_console()).stdout
|
|
98
|
+
except (OSError, subprocess.SubprocessError):
|
|
99
|
+
return 0
|
|
100
|
+
match = re.search(r"version (\d+)\.", out)
|
|
101
|
+
return int(match.group(1)) if match else 0
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def no_console() -> dict:
|
|
105
|
+
"""Keep Windows from opening a console window for every child process."""
|
|
106
|
+
return {"creationflags": subprocess.CREATE_NO_WINDOW} if IS_WIN else {}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def build_args(v: dict, password: str) -> list[str]:
|
|
110
|
+
"""Client arguments for the connection settings v, without the program name."""
|
|
111
|
+
v = {**FIELDS, **v}
|
|
112
|
+
args = [f"/v:{v['host'].strip()}"]
|
|
113
|
+
if v["port"].strip():
|
|
114
|
+
args.append(f"/port:{v['port'].strip()}")
|
|
115
|
+
if v["user"].strip():
|
|
116
|
+
args.append(f"/u:{v['user'].strip()}")
|
|
117
|
+
if v["domain"].strip():
|
|
118
|
+
args.append(f"/d:{v['domain'].strip()}")
|
|
119
|
+
if password:
|
|
120
|
+
args.append(f"/p:{password}")
|
|
121
|
+
if v["gateway"].strip():
|
|
122
|
+
args.append(f"/gateway:g:{v['gateway'].strip()}")
|
|
123
|
+
args.append(f"/cert:{v['cert']}")
|
|
124
|
+
if v["fullscreen"]:
|
|
125
|
+
args.append("/f")
|
|
126
|
+
elif v["size"].strip():
|
|
127
|
+
args.append(f"/size:{v['size'].strip()}")
|
|
128
|
+
if v["dynamic"]:
|
|
129
|
+
args.append("/dynamic-resolution")
|
|
130
|
+
if v["multimon"]:
|
|
131
|
+
args.append("/multimon")
|
|
132
|
+
if v["gfx"] == "off":
|
|
133
|
+
args.append("-gfx")
|
|
134
|
+
elif v["gfx"] != "(default)":
|
|
135
|
+
args.append(f"/gfx:{v['gfx']}")
|
|
136
|
+
args.append("+clipboard" if v["clipboard"] else "-clipboard")
|
|
137
|
+
if v["sound"]:
|
|
138
|
+
args.append("/sound")
|
|
139
|
+
if v["microphone"]:
|
|
140
|
+
args.append("/microphone")
|
|
141
|
+
if v["home_drive"]:
|
|
142
|
+
args.append("+home-drive")
|
|
143
|
+
if v["drive"].strip():
|
|
144
|
+
path = v["drive"].strip()
|
|
145
|
+
args.append(f"/drive:{Path(path).name or 'share'},{path}")
|
|
146
|
+
if v["log_level"] != "(default)":
|
|
147
|
+
args.append(f"/log-level:{v['log_level']}")
|
|
148
|
+
return args + shlex.split(v["extra"], posix=not IS_WIN)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def join_command(argv: list[str]) -> str:
|
|
152
|
+
return subprocess.list2cmdline(argv) if IS_WIN else shlex.join(argv)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class Session:
|
|
156
|
+
"""One running client, with a thread that forwards its output to a queue."""
|
|
157
|
+
|
|
158
|
+
def __init__(self, label: str, proc: subprocess.Popen, out: queue.Queue):
|
|
159
|
+
self.label = label
|
|
160
|
+
self.proc = proc
|
|
161
|
+
threading.Thread(target=self._pump, args=(out,), daemon=True).start()
|
|
162
|
+
|
|
163
|
+
def _pump(self, out: queue.Queue):
|
|
164
|
+
for line in self.proc.stdout:
|
|
165
|
+
out.put((self, line.rstrip("\n")))
|
|
166
|
+
out.put((self, None))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class App(ttk.Frame):
|
|
170
|
+
def __init__(self, root: tk.Tk):
|
|
171
|
+
super().__init__(root, padding=8)
|
|
172
|
+
self.root = root
|
|
173
|
+
self.vars = {k: tk.BooleanVar(value=v) if isinstance(v, bool) else tk.StringVar(value=v)
|
|
174
|
+
for k, v in FIELDS.items()}
|
|
175
|
+
self.name = tk.StringVar()
|
|
176
|
+
self.password = tk.StringVar()
|
|
177
|
+
self.filter = tk.StringVar()
|
|
178
|
+
self.store = config_dir() / "profiles.json"
|
|
179
|
+
self.saved = self._load_saved()
|
|
180
|
+
self.passwords: dict[str, str] = {} # per saved connection, memory only
|
|
181
|
+
self.sessions: list[Session] = []
|
|
182
|
+
self.output: queue.Queue = queue.Queue()
|
|
183
|
+
self.versions: dict[str, int] = {}
|
|
184
|
+
self.clients = find_clients()
|
|
185
|
+
|
|
186
|
+
self._build()
|
|
187
|
+
self.pack(fill="both", expand=True)
|
|
188
|
+
for var in (*self.vars.values(), self.password):
|
|
189
|
+
var.trace_add("write", lambda *_: self._refresh_preview())
|
|
190
|
+
self.filter.trace_add("write", lambda *_: self._refresh_saved())
|
|
191
|
+
self._refresh_saved()
|
|
192
|
+
self._refresh_preview()
|
|
193
|
+
self._log(f"clients found: {', '.join(self.clients) or 'none'}")
|
|
194
|
+
self.after(100, self._drain_output)
|
|
195
|
+
root.protocol("WM_DELETE_WINDOW", self._quit)
|
|
196
|
+
|
|
197
|
+
# ---- layout -----------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
def _build(self):
|
|
200
|
+
upper = ttk.Frame(self)
|
|
201
|
+
upper.pack(fill="x")
|
|
202
|
+
|
|
203
|
+
side = ttk.Frame(upper)
|
|
204
|
+
side.pack(side="left", fill="y", padx=(0, 8))
|
|
205
|
+
ttk.Label(side, text="Saved connections").pack(anchor="w")
|
|
206
|
+
ttk.Entry(side, textvariable=self.filter).pack(fill="x", pady=(2, 4))
|
|
207
|
+
self.saved_list = tk.Listbox(side, width=26, height=14, selectmode="extended",
|
|
208
|
+
exportselection=False)
|
|
209
|
+
self.saved_list.pack(fill="both", expand=True)
|
|
210
|
+
self.saved_list.bind("<<ListboxSelect>>", lambda _: self._on_select())
|
|
211
|
+
self.saved_list.bind("<Double-Button-1>", lambda _: self._connect())
|
|
212
|
+
row = ttk.Frame(side)
|
|
213
|
+
row.pack(fill="x", pady=(4, 0))
|
|
214
|
+
ttk.Button(row, text="New", width=6, command=self._new).pack(side="left")
|
|
215
|
+
ttk.Button(row, text="Save", width=6, command=self._save).pack(side="left", padx=2)
|
|
216
|
+
ttk.Button(row, text="Delete", width=6, command=self._delete).pack(side="left")
|
|
217
|
+
|
|
218
|
+
tabs = ttk.Notebook(upper)
|
|
219
|
+
tabs.pack(side="left", fill="both", expand=True)
|
|
220
|
+
tabs.add(self._connection_tab(tabs), text="Connection")
|
|
221
|
+
tabs.add(self._display_tab(tabs), text="Display")
|
|
222
|
+
tabs.add(self._devices_tab(tabs), text="Devices")
|
|
223
|
+
tabs.add(self._advanced_tab(tabs), text="Advanced")
|
|
224
|
+
|
|
225
|
+
ttk.Label(self, text="Command").pack(anchor="w", pady=(8, 0))
|
|
226
|
+
self.preview = tk.Text(self, height=3, wrap="word", relief="flat",
|
|
227
|
+
background=self.root.cget("background"))
|
|
228
|
+
self.preview.pack(fill="x")
|
|
229
|
+
|
|
230
|
+
buttons = ttk.Frame(self)
|
|
231
|
+
buttons.pack(fill="x", pady=6)
|
|
232
|
+
self.connect_button = ttk.Button(buttons, text="Connect", command=self._connect)
|
|
233
|
+
self.connect_button.pack(side="left")
|
|
234
|
+
ttk.Button(buttons, text="Disconnect", command=self._disconnect).pack(side="left", padx=4)
|
|
235
|
+
ttk.Button(buttons, text="Copy command", command=self._copy_command).pack(side="left")
|
|
236
|
+
ttk.Button(buttons, text="Clear log",
|
|
237
|
+
command=lambda: self.log.delete("1.0", "end")).pack(side="right")
|
|
238
|
+
|
|
239
|
+
panes = ttk.PanedWindow(self, orient="horizontal")
|
|
240
|
+
panes.pack(fill="both", expand=True)
|
|
241
|
+
left = ttk.Frame(panes)
|
|
242
|
+
ttk.Label(left, text="Running").pack(anchor="w")
|
|
243
|
+
self.running_list = tk.Listbox(left, width=26, selectmode="extended",
|
|
244
|
+
exportselection=False)
|
|
245
|
+
self.running_list.pack(fill="both", expand=True)
|
|
246
|
+
panes.add(left, weight=0)
|
|
247
|
+
right = ttk.Frame(panes)
|
|
248
|
+
ttk.Label(right, text="Log").pack(anchor="w")
|
|
249
|
+
self.log = tk.Text(right, height=10, wrap="none", font="TkFixedFont")
|
|
250
|
+
scroll = ttk.Scrollbar(right, command=self.log.yview)
|
|
251
|
+
self.log.configure(yscrollcommand=scroll.set)
|
|
252
|
+
scroll.pack(side="right", fill="y")
|
|
253
|
+
self.log.pack(fill="both", expand=True)
|
|
254
|
+
panes.add(right, weight=1)
|
|
255
|
+
|
|
256
|
+
self.root.bind("<Return>", lambda _: self._connect())
|
|
257
|
+
|
|
258
|
+
def _grid(self, parent) -> ttk.Frame:
|
|
259
|
+
frame = ttk.Frame(parent, padding=8)
|
|
260
|
+
frame.columnconfigure(1, weight=1)
|
|
261
|
+
return frame
|
|
262
|
+
|
|
263
|
+
def _row(self, frame, row, label, widget):
|
|
264
|
+
ttk.Label(frame, text=label).grid(row=row, column=0, sticky="w", pady=2, padx=(0, 8))
|
|
265
|
+
widget.grid(row=row, column=1, sticky="ew", pady=2)
|
|
266
|
+
|
|
267
|
+
def _check(self, frame, row, label, key):
|
|
268
|
+
ttk.Checkbutton(frame, text=label, variable=self.vars[key]).grid(
|
|
269
|
+
row=row, column=0, columnspan=2, sticky="w", pady=2)
|
|
270
|
+
|
|
271
|
+
def _connection_tab(self, parent):
|
|
272
|
+
f = self._grid(parent)
|
|
273
|
+
self._row(f, 0, "Name", ttk.Entry(f, textvariable=self.name))
|
|
274
|
+
client = ttk.Frame(f)
|
|
275
|
+
ttk.Combobox(client, textvariable=self.vars["client"], values=[AUTO, *self.clients]).pack(
|
|
276
|
+
side="left", fill="x", expand=True)
|
|
277
|
+
ttk.Button(client, text="…", width=3, command=self._browse_client).pack(side="left")
|
|
278
|
+
self._row(f, 1, "Client", client)
|
|
279
|
+
host = ttk.Entry(f, textvariable=self.vars["host"])
|
|
280
|
+
self._row(f, 2, "Host", host)
|
|
281
|
+
host.focus_set()
|
|
282
|
+
self._row(f, 3, "Port", ttk.Entry(f, textvariable=self.vars["port"], width=8))
|
|
283
|
+
self._row(f, 4, "User", ttk.Entry(f, textvariable=self.vars["user"]))
|
|
284
|
+
self._row(f, 5, "Domain", ttk.Entry(f, textvariable=self.vars["domain"]))
|
|
285
|
+
self._row(f, 6, "Password", ttk.Entry(f, textvariable=self.password, show="•"))
|
|
286
|
+
self._row(f, 7, "Gateway", ttk.Entry(f, textvariable=self.vars["gateway"]))
|
|
287
|
+
self._row(f, 8, "Certificate", ttk.Combobox(f, textvariable=self.vars["cert"],
|
|
288
|
+
values=CERT_CHOICES, state="readonly"))
|
|
289
|
+
return f
|
|
290
|
+
|
|
291
|
+
def _display_tab(self, parent):
|
|
292
|
+
f = self._grid(parent)
|
|
293
|
+
self._check(f, 0, "Full screen", "fullscreen")
|
|
294
|
+
self._row(f, 1, "Window size", ttk.Combobox(
|
|
295
|
+
f, textvariable=self.vars["size"],
|
|
296
|
+
values=["1280x720", "1600x900", "1920x1080", "2560x1440", "80%", "100%"]))
|
|
297
|
+
self._check(f, 2, "Resize the remote desktop with the window", "dynamic")
|
|
298
|
+
self._check(f, 3, "Use all monitors", "multimon")
|
|
299
|
+
self._row(f, 4, "Graphics codec", ttk.Combobox(f, textvariable=self.vars["gfx"],
|
|
300
|
+
values=GFX_CHOICES, state="readonly"))
|
|
301
|
+
return f
|
|
302
|
+
|
|
303
|
+
def _devices_tab(self, parent):
|
|
304
|
+
f = self._grid(parent)
|
|
305
|
+
self._check(f, 0, "Clipboard", "clipboard")
|
|
306
|
+
self._check(f, 1, "Play remote sound here", "sound")
|
|
307
|
+
self._check(f, 2, "Microphone", "microphone")
|
|
308
|
+
self._check(f, 3, "Share home folder", "home_drive")
|
|
309
|
+
drive = ttk.Frame(f)
|
|
310
|
+
ttk.Entry(drive, textvariable=self.vars["drive"]).pack(side="left", fill="x", expand=True)
|
|
311
|
+
ttk.Button(drive, text="…", width=3, command=self._browse_drive).pack(side="left")
|
|
312
|
+
self._row(f, 4, "Share folder", drive)
|
|
313
|
+
return f
|
|
314
|
+
|
|
315
|
+
def _advanced_tab(self, parent):
|
|
316
|
+
f = self._grid(parent)
|
|
317
|
+
self._row(f, 0, "Log level", ttk.Combobox(f, textvariable=self.vars["log_level"],
|
|
318
|
+
values=LOG_LEVELS, state="readonly"))
|
|
319
|
+
self._row(f, 1, "Extra arguments", ttk.Entry(f, textvariable=self.vars["extra"]))
|
|
320
|
+
ttk.Label(f, text="e.g. /scale:140 +auto-reconnect /kbd:layout:0x409",
|
|
321
|
+
foreground="gray").grid(row=2, column=1, sticky="w")
|
|
322
|
+
return f
|
|
323
|
+
|
|
324
|
+
# ---- command line -----------------------------------------------------
|
|
325
|
+
|
|
326
|
+
def _form(self) -> dict:
|
|
327
|
+
return {k: var.get() for k, var in self.vars.items()}
|
|
328
|
+
|
|
329
|
+
def _resolve_client(self, choice: str) -> str:
|
|
330
|
+
"""The program to run for a client choice; "" when there is none."""
|
|
331
|
+
choice = choice.strip()
|
|
332
|
+
if choice in ("", AUTO):
|
|
333
|
+
return self.clients[0] if self.clients else ""
|
|
334
|
+
return choice if shutil.which(choice) or Path(choice).is_file() else ""
|
|
335
|
+
|
|
336
|
+
def _command_text(self) -> str:
|
|
337
|
+
v = self._form()
|
|
338
|
+
client = self._resolve_client(v["client"]) or "<no client found>"
|
|
339
|
+
try:
|
|
340
|
+
args = build_args(v, HIDDEN if self.password.get() else "")
|
|
341
|
+
except ValueError as e: # unbalanced quotes in the extra arguments
|
|
342
|
+
return f"error in extra arguments: {e}"
|
|
343
|
+
return join_command([client, *args])
|
|
344
|
+
|
|
345
|
+
def _refresh_preview(self):
|
|
346
|
+
self.preview.configure(state="normal")
|
|
347
|
+
self.preview.delete("1.0", "end")
|
|
348
|
+
self.preview.insert("1.0", self._command_text())
|
|
349
|
+
self.preview.configure(state="disabled")
|
|
350
|
+
|
|
351
|
+
def _copy_command(self):
|
|
352
|
+
self.root.clipboard_clear()
|
|
353
|
+
self.root.clipboard_append(self._command_text())
|
|
354
|
+
self._log("command copied (password hidden)")
|
|
355
|
+
|
|
356
|
+
# ---- sessions ---------------------------------------------------------
|
|
357
|
+
|
|
358
|
+
def _connect(self):
|
|
359
|
+
names = self._selected_names()
|
|
360
|
+
if len(names) > 1: # several saved connections: start each one as saved
|
|
361
|
+
for name in names:
|
|
362
|
+
if not self._launch(name, self.saved[name], self.passwords.get(name)):
|
|
363
|
+
break
|
|
364
|
+
return
|
|
365
|
+
name = self.name.get().strip() or self.vars["host"].get().strip()
|
|
366
|
+
password = self.password.get() or self.passwords.get(name)
|
|
367
|
+
if self._launch(name, self._form(), password) and self.password.get():
|
|
368
|
+
self.passwords[name] = self.password.get()
|
|
369
|
+
|
|
370
|
+
def _launch(self, name: str, v: dict, password: str | None) -> bool:
|
|
371
|
+
"""Start one client; False when it did not start and the user was told why."""
|
|
372
|
+
v = {**FIELDS, **v}
|
|
373
|
+
client = self._resolve_client(v["client"])
|
|
374
|
+
if not client:
|
|
375
|
+
messagebox.showerror(APP, f"{name}: no FreeRDP client found. Choose one under "
|
|
376
|
+
"Connection → Client.")
|
|
377
|
+
return False
|
|
378
|
+
if not v["host"].strip():
|
|
379
|
+
messagebox.showerror(APP, "Enter a host to connect to.")
|
|
380
|
+
return False
|
|
381
|
+
if password is None and v["user"].strip():
|
|
382
|
+
password = simpledialog.askstring(APP, f"Password for {v['user']} on {name}",
|
|
383
|
+
show="•", parent=self.root)
|
|
384
|
+
if password is None:
|
|
385
|
+
return False
|
|
386
|
+
self.passwords[name] = password
|
|
387
|
+
try:
|
|
388
|
+
args = build_args(v, password or "")
|
|
389
|
+
except ValueError as e:
|
|
390
|
+
messagebox.showerror(APP, f"{name}: extra arguments: {e}")
|
|
391
|
+
return False
|
|
392
|
+
if any("\n" in a or "\r" in a for a in args):
|
|
393
|
+
messagebox.showerror(APP, f"{name}: values must not contain line breaks.")
|
|
394
|
+
return False
|
|
395
|
+
|
|
396
|
+
if client not in self.versions:
|
|
397
|
+
self.versions[client] = client_major_version(client)
|
|
398
|
+
via_stdin = self.versions[client] >= 3
|
|
399
|
+
argv = [client, "/args-from:stdin"] if via_stdin else [client, *args]
|
|
400
|
+
try:
|
|
401
|
+
proc = subprocess.Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
|
402
|
+
stderr=subprocess.STDOUT, text=True, errors="replace",
|
|
403
|
+
**no_console())
|
|
404
|
+
except OSError as e:
|
|
405
|
+
messagebox.showerror(APP, f"Cannot start {client}:\n{e}")
|
|
406
|
+
return False
|
|
407
|
+
if via_stdin:
|
|
408
|
+
proc.stdin.write("".join(a + "\n" for a in args))
|
|
409
|
+
proc.stdin.close() # nothing is left to answer prompts, so they fail fast
|
|
410
|
+
|
|
411
|
+
session = Session(f"{name} [{proc.pid}]", proc, self.output)
|
|
412
|
+
self.sessions.append(session)
|
|
413
|
+
self.running_list.insert("end", session.label)
|
|
414
|
+
if not via_stdin:
|
|
415
|
+
self._log("note: not a FreeRDP 3 client, the password is on the command line",
|
|
416
|
+
session)
|
|
417
|
+
shown = build_args(v, HIDDEN if password else "")
|
|
418
|
+
self._log(f"started: {join_command([client, *shown])}", session)
|
|
419
|
+
return True
|
|
420
|
+
|
|
421
|
+
def _disconnect(self):
|
|
422
|
+
for index in self.running_list.curselection():
|
|
423
|
+
proc = self.sessions[index].proc
|
|
424
|
+
if proc.poll() is None:
|
|
425
|
+
proc.terminate()
|
|
426
|
+
|
|
427
|
+
def _drain_output(self):
|
|
428
|
+
try:
|
|
429
|
+
while True:
|
|
430
|
+
session, line = self.output.get_nowait()
|
|
431
|
+
if line is not None:
|
|
432
|
+
self._log(line, session)
|
|
433
|
+
continue
|
|
434
|
+
code = session.proc.wait()
|
|
435
|
+
self._log(f"exited with code {code}", session)
|
|
436
|
+
index = self.sessions.index(session)
|
|
437
|
+
self.sessions.pop(index)
|
|
438
|
+
self.running_list.delete(index)
|
|
439
|
+
except queue.Empty:
|
|
440
|
+
pass
|
|
441
|
+
self.after(100, self._drain_output)
|
|
442
|
+
|
|
443
|
+
def _log(self, text: str, session: Session | None = None):
|
|
444
|
+
prefix = f"[{session.label}] " if session else ""
|
|
445
|
+
at_end = self.log.yview()[1] >= 0.999
|
|
446
|
+
self.log.insert("end", prefix + text + "\n")
|
|
447
|
+
if at_end:
|
|
448
|
+
self.log.see("end")
|
|
449
|
+
|
|
450
|
+
def _quit(self):
|
|
451
|
+
running = [s for s in self.sessions if s.proc.poll() is None]
|
|
452
|
+
if running and not messagebox.askyesno(
|
|
453
|
+
APP, f"{len(running)} session(s) still running. Close them and quit?"):
|
|
454
|
+
return
|
|
455
|
+
for s in running:
|
|
456
|
+
s.proc.terminate()
|
|
457
|
+
self.root.destroy()
|
|
458
|
+
|
|
459
|
+
# ---- saved connections ------------------------------------------------
|
|
460
|
+
|
|
461
|
+
def _load_saved(self) -> dict:
|
|
462
|
+
try:
|
|
463
|
+
data = json.loads(self.store.read_text(encoding="utf-8"))
|
|
464
|
+
except (OSError, ValueError):
|
|
465
|
+
return {}
|
|
466
|
+
for v in data.values(): # files from older versions stored "" for auto
|
|
467
|
+
if not v.get("client"):
|
|
468
|
+
v["client"] = AUTO
|
|
469
|
+
return data
|
|
470
|
+
|
|
471
|
+
def _write_saved(self):
|
|
472
|
+
self.store.parent.mkdir(parents=True, exist_ok=True)
|
|
473
|
+
self.store.write_text(json.dumps(self.saved, indent=2), encoding="utf-8")
|
|
474
|
+
self._refresh_saved()
|
|
475
|
+
|
|
476
|
+
def _refresh_saved(self, select: str | None = None):
|
|
477
|
+
needle = self.filter.get().strip().lower()
|
|
478
|
+
self.visible = [n for n in sorted(self.saved, key=str.lower)
|
|
479
|
+
if needle in n.lower() or needle in self.saved[n].get("host", "").lower()]
|
|
480
|
+
self.saved_list.delete(0, "end")
|
|
481
|
+
for name in self.visible:
|
|
482
|
+
self.saved_list.insert("end", name)
|
|
483
|
+
if select in self.visible:
|
|
484
|
+
self.saved_list.selection_set(self.visible.index(select))
|
|
485
|
+
self._update_connect_label()
|
|
486
|
+
|
|
487
|
+
def _selected_names(self) -> list[str]:
|
|
488
|
+
return [self.visible[i] for i in self.saved_list.curselection()]
|
|
489
|
+
|
|
490
|
+
def _update_connect_label(self):
|
|
491
|
+
count = len(self._selected_names())
|
|
492
|
+
self.connect_button.configure(text=f"Connect {count}" if count > 1 else "Connect")
|
|
493
|
+
|
|
494
|
+
def _on_select(self):
|
|
495
|
+
names = self._selected_names()
|
|
496
|
+
self._update_connect_label()
|
|
497
|
+
if len(names) != 1:
|
|
498
|
+
return
|
|
499
|
+
name = names[0]
|
|
500
|
+
data = self.saved[name]
|
|
501
|
+
self.name.set(name)
|
|
502
|
+
for key, default in FIELDS.items():
|
|
503
|
+
self.vars[key].set(data.get(key, default))
|
|
504
|
+
self.password.set(self.passwords.get(name, ""))
|
|
505
|
+
|
|
506
|
+
def _new(self):
|
|
507
|
+
self.saved_list.selection_clear(0, "end")
|
|
508
|
+
self.name.set("")
|
|
509
|
+
for key, default in FIELDS.items():
|
|
510
|
+
self.vars[key].set(default)
|
|
511
|
+
self.password.set("")
|
|
512
|
+
self._update_connect_label()
|
|
513
|
+
|
|
514
|
+
def _save(self):
|
|
515
|
+
name = self.name.get().strip() or self.vars["host"].get().strip()
|
|
516
|
+
if not name:
|
|
517
|
+
messagebox.showerror(APP, "Enter a name or a host first.")
|
|
518
|
+
return
|
|
519
|
+
self.saved[name] = self._form()
|
|
520
|
+
self.name.set(name)
|
|
521
|
+
if self.password.get():
|
|
522
|
+
self.passwords[name] = self.password.get()
|
|
523
|
+
self._write_saved()
|
|
524
|
+
self._refresh_saved(select=name)
|
|
525
|
+
self._log(f"saved '{name}' to {self.store} (without password)")
|
|
526
|
+
|
|
527
|
+
def _delete(self):
|
|
528
|
+
names = self._selected_names()
|
|
529
|
+
if names and messagebox.askyesno(APP, f"Delete {', '.join(names)}?"):
|
|
530
|
+
for name in names:
|
|
531
|
+
self.saved.pop(name, None)
|
|
532
|
+
self.passwords.pop(name, None)
|
|
533
|
+
self._write_saved()
|
|
534
|
+
|
|
535
|
+
# ---- file pickers -----------------------------------------------------
|
|
536
|
+
|
|
537
|
+
def _browse_client(self):
|
|
538
|
+
path = filedialog.askopenfilename(title="FreeRDP client")
|
|
539
|
+
if path:
|
|
540
|
+
self.vars["client"].set(path)
|
|
541
|
+
|
|
542
|
+
def _browse_drive(self):
|
|
543
|
+
path = filedialog.askdirectory(title="Folder to share")
|
|
544
|
+
if path:
|
|
545
|
+
self.vars["drive"].set(path)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def main():
|
|
549
|
+
root = tk.Tk()
|
|
550
|
+
root.title("FreeRDP")
|
|
551
|
+
root.minsize(760, 640)
|
|
552
|
+
style = ttk.Style(root)
|
|
553
|
+
if not (IS_WIN or IS_MAC) and "clam" in style.theme_names():
|
|
554
|
+
style.theme_use("clam") # the default X11 theme looks dated
|
|
555
|
+
App(root)
|
|
556
|
+
root.mainloop()
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
if __name__ == "__main__":
|
|
560
|
+
main()
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: freerdp-tk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A small cross-platform Tkinter launcher for the FreeRDP remote desktop clients
|
|
5
|
+
Project-URL: Homepage, https://github.com/congzhangzh/freerdp-tk
|
|
6
|
+
Project-URL: Issues, https://github.com/congzhangzh/freerdp-tk/issues
|
|
7
|
+
Author-email: Cong Zhang <lucien.c.zhang@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: freerdp,launcher,rdp,remote desktop,tkinter
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: MacOS X
|
|
13
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
14
|
+
Classifier: Environment :: X11 Applications
|
|
15
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Topic :: System :: Networking
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# freerdp-tk
|
|
23
|
+
|
|
24
|
+
A small launcher window for the [FreeRDP](https://www.freerdp.com/) remote desktop clients.
|
|
25
|
+
It runs on Linux, Windows and macOS and needs nothing beyond Python and its built-in Tkinter.
|
|
26
|
+
|
|
27
|
+
- **Saved connections:** a list you can filter. Double-click one to connect, or select several and connect them all at once.
|
|
28
|
+
- **Picks a client for you:** it finds the FreeRDP clients on your `PATH` and in local build trees. "(auto)" prefers the SDL client, then X11, Wayland and Windows.
|
|
29
|
+
- **Form instead of flags:** display, graphics codec (including AV1), clipboard, sound, microphone, drive sharing, log level, plus a box for extra arguments.
|
|
30
|
+
- **Live command preview:** shows the exact command line, with the password hidden, and copies it for you.
|
|
31
|
+
- **Session log:** runs several sessions at once and shows each client's output.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv tool install freerdp-tk # or: pipx install freerdp-tk
|
|
37
|
+
freerdp-tk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You also need a FreeRDP client, for example:
|
|
41
|
+
|
|
42
|
+
| Platform | Client |
|
|
43
|
+
|----------|--------|
|
|
44
|
+
| Debian / Ubuntu | `sudo apt install freerdp3-sdl` (or `freerdp3-x11`) |
|
|
45
|
+
| Fedora | `sudo dnf install freerdp` |
|
|
46
|
+
| macOS | `brew install freerdp` |
|
|
47
|
+
| Windows | a FreeRDP build containing `sdl-freerdp.exe` or `wfreerdp.exe`, on your `PATH` |
|
|
48
|
+
|
|
49
|
+
On Linux, a system Python may need its Tk package (`sudo apt install python3-tk`). The Pythons that `uv` installs already include Tk.
|
|
50
|
+
|
|
51
|
+
## Passwords
|
|
52
|
+
|
|
53
|
+
- Passwords are **never written to disk**. They are asked for once and kept in memory until the window closes.
|
|
54
|
+
- With FreeRDP 3, all arguments are passed to the client through standard input (`/args-from:stdin`). The password therefore never appears in the process list (`ps`, Task Manager).
|
|
55
|
+
- FreeRDP 2 has no such option, so the password goes on the command line, and the log warns you about it.
|
|
56
|
+
|
|
57
|
+
## Where things are kept
|
|
58
|
+
|
|
59
|
+
| What | Where |
|
|
60
|
+
|------|-------|
|
|
61
|
+
| Saved connections | `~/.config/freerdp-tk/profiles.json` (Linux), `~/Library/Application Support/freerdp-tk/` (macOS), `%APPDATA%\freerdp-tk\` (Windows) |
|
|
62
|
+
| Extra FreeRDP source trees to search for built clients | `FREERDP_TK_TREES`, separated like `PATH`. `~/projects/FreeRDP` is always searched. |
|
|
63
|
+
|
|
64
|
+
## Limitation
|
|
65
|
+
|
|
66
|
+
The client runs without a terminal, so it cannot ask questions while connecting, such as whether to trust a new certificate. Pick a certificate policy (`tofu`, `ignore` or `deny`) on the Connection tab instead. The default, `tofu`, trusts a server's certificate the first time you connect.
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uv run --with-editable . python -m freerdp_tk # run from the checkout
|
|
72
|
+
uv build # build the sdist and wheel into dist/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Releasing to PyPI
|
|
76
|
+
|
|
77
|
+
Releases are published by GitHub Actions through [trusted publishing](https://docs.pypi.org/trusted-publishers/), so no API token is needed. The version is taken from the git tag.
|
|
78
|
+
|
|
79
|
+
One-time setup:
|
|
80
|
+
1. On PyPI, open *Your projects → Publishing → Add a new pending publisher* and enter: project `freerdp-tk`, owner `congzhangzh`, repository `freerdp-tk`, workflow `release.yml`, environment `pypi`.
|
|
81
|
+
2. On GitHub, create an environment named `pypi` (*Settings → Environments*).
|
|
82
|
+
|
|
83
|
+
Each release after that:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git tag v0.1.0
|
|
87
|
+
git push origin v0.1.0
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The workflow builds the package, checks that it installs on Linux, Windows and macOS, and then uploads it to PyPI.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
Apache-2.0, the same license as FreeRDP.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
freerdp_tk/__init__.py,sha256=zoNDHFoDvLLxIT4oWhgN_1Q0P5LpVd4ad6by0Zj8x1M,280
|
|
2
|
+
freerdp_tk/__main__.py,sha256=3LvDK1EK2nU7rMjOsolJ6UkJnuOdH_wMxl0t8_48U4w,40
|
|
3
|
+
freerdp_tk/app.py,sha256=g31CUzH7YFIOX3pbdOjFEhusngPnnK8wu9KMlauTIhU,23687
|
|
4
|
+
freerdp_tk-0.1.0.dist-info/METADATA,sha256=i6rm_6HGHjcH6WLYHw1ZUnePPLxEBhPdsiiQ13nBzbM,4279
|
|
5
|
+
freerdp_tk-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
6
|
+
freerdp_tk-0.1.0.dist-info/entry_points.txt,sha256=RdT1WESIS1Lmo5xx3-YYHf8we96w7udFA8fwtEbFOZQ,47
|
|
7
|
+
freerdp_tk-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
8
|
+
freerdp_tk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|