dsh-pocket-relay 1.0.0
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.
- package/LICENSE +344 -0
- package/README.en.md +219 -0
- package/README.md +258 -0
- package/bin/dsh-pocket-relay.mjs +216 -0
- package/client/api.js +88 -0
- package/client/build.mjs +47 -0
- package/client/client.js +3238 -0
- package/client/index.jsx +979 -0
- package/client/mobile/LICENSE.dsh-web-mobile +4 -0
- package/client/mobile/MobileDrawerFooter.tsx +56 -0
- package/client/mobile/MobileNavOverlay.tsx +290 -0
- package/client/mobile/MobileNavToggle.tsx +52 -0
- package/client/mobile/fileGuard.ts +200 -0
- package/client/mobile/layout-mode.mjs +46 -0
- package/client/mobile/locales.ts +23 -0
- package/client/mobile/mobile-apply.tsx +378 -0
- package/client/mobile/mobile.css.ts +1005 -0
- package/client/mobile/nav-targets.mjs +85 -0
- package/client/pocket-locales.js +331 -0
- package/cordis.patch.yml +11 -0
- package/lib/device-auth-http.mjs +338 -0
- package/lib/device-auth.mjs +485 -0
- package/lib/index.js +414 -0
- package/lib/ip.mjs +11 -0
- package/lib/proxy.mjs +1223 -0
- package/lib/relay-protocol.mjs +101 -0
- package/lib/relay.mjs +355 -0
- package/lib/restart.js +112 -0
- package/lib/service.mjs +578 -0
- package/lib/settings.mjs +392 -0
- package/lib/tunnel.mjs +621 -0
- package/lib/web-rpc.js +622 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 2, June 1991
|
|
3
|
+
|
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
6
|
+
|
|
7
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
8
|
+
of this license document, but changing it is not allowed.
|
|
9
|
+
|
|
10
|
+
Preamble
|
|
11
|
+
|
|
12
|
+
The licenses for most software are designed to take away your
|
|
13
|
+
freedom to share and change it. By contrast, the GNU General Public
|
|
14
|
+
License is intended to guarantee your freedom to share and change free
|
|
15
|
+
software--to make sure the software is free for all its users. This
|
|
16
|
+
General Public License applies to most of the Free Software
|
|
17
|
+
Foundation's software and to any other program whose authors commit to
|
|
18
|
+
using it. (Some other Free Software Foundation software is covered by
|
|
19
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
|
20
|
+
your programs, too.
|
|
21
|
+
|
|
22
|
+
When we speak of free software, we are referring to freedom, not
|
|
23
|
+
price. Our General Public Licenses are designed to make sure that you
|
|
24
|
+
have the freedom to distribute copies of free software (and charge for
|
|
25
|
+
this service if you wish), that you receive source code or can get it
|
|
26
|
+
if you want it, that you can change the software or use pieces of it
|
|
27
|
+
in new free programs; and that you know you can do these things.
|
|
28
|
+
|
|
29
|
+
To protect your rights, we need to make restrictions that forbid
|
|
30
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
|
31
|
+
These restrictions translate to certain responsibilities for you if you
|
|
32
|
+
distribute copies of the software, or if you modify it.
|
|
33
|
+
|
|
34
|
+
For example, if you distribute copies of such a program, whether
|
|
35
|
+
gratis or for a fee, you must give the recipients all the rights that
|
|
36
|
+
you have. You must make sure that they, too, receive or can get the
|
|
37
|
+
source code. And you must show them these terms so they know their
|
|
38
|
+
rights.
|
|
39
|
+
|
|
40
|
+
We protect your rights with two steps: (1) copyright the software, and
|
|
41
|
+
(2) offer you this license which gives you legal permission to copy,
|
|
42
|
+
distribute and/or modify the software.
|
|
43
|
+
|
|
44
|
+
Also, for each author's protection and ours, we want to make certain
|
|
45
|
+
that everyone understands that there is no warranty for this free
|
|
46
|
+
software. If the software is modified by someone else and passed on, we
|
|
47
|
+
want its recipients to know that what they have is not the original, so
|
|
48
|
+
that any problems introduced by others will not reflect on the original
|
|
49
|
+
authors' reputations.
|
|
50
|
+
|
|
51
|
+
Finally, any free program is threatened constantly by software
|
|
52
|
+
patents. We wish to avoid the danger that redistributors of a free
|
|
53
|
+
program will individually obtain patent licenses, in effect making the
|
|
54
|
+
program proprietary. To prevent this, we have made it clear that any
|
|
55
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
|
56
|
+
|
|
57
|
+
The precise terms and conditions for copying, distribution and
|
|
58
|
+
modification follow.
|
|
59
|
+
|
|
60
|
+
GNU GENERAL PUBLIC LICENSE
|
|
61
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
62
|
+
|
|
63
|
+
0. This License applies to any program or other work which contains
|
|
64
|
+
a notice placed by the copyright holder saying it may be distributed
|
|
65
|
+
under the terms of this General Public License. The "Program", below,
|
|
66
|
+
refers to any such program or work, and a "work based on the Program"
|
|
67
|
+
means either the Program or any derivative work under copyright law:
|
|
68
|
+
that is to say, a work containing the Program or a portion of it,
|
|
69
|
+
either verbatim or with modifications and/or translated into another
|
|
70
|
+
language. (Hereinafter, translation is included without limitation in
|
|
71
|
+
the term "modification".) Each licensee is addressed as "you".
|
|
72
|
+
|
|
73
|
+
Activities other than copying, distribution and modification are not
|
|
74
|
+
covered by this License; they are outside its scope. The act of
|
|
75
|
+
running the Program is not restricted, and the output from the Program
|
|
76
|
+
is covered only if its contents constitute a work based on the
|
|
77
|
+
Program (independent of having been made by running the Program).
|
|
78
|
+
Whether that is true depends on what the Program does.
|
|
79
|
+
|
|
80
|
+
1. You may copy and distribute verbatim copies of the Program's
|
|
81
|
+
source code as you receive it, in any medium, provided that you
|
|
82
|
+
conspicuously and appropriately publish on each copy an appropriate
|
|
83
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
|
84
|
+
notices that refer to this License and to the absence of any warranty;
|
|
85
|
+
and give any other recipients of the Program a copy of this License
|
|
86
|
+
along with the Program.
|
|
87
|
+
|
|
88
|
+
You may charge a fee for the physical act of transferring a copy, and
|
|
89
|
+
you may at your option offer warranty protection in exchange for a fee.
|
|
90
|
+
|
|
91
|
+
2. You may modify your copy or copies of the Program or any portion
|
|
92
|
+
of it, thus forming a work based on the Program, and copy and
|
|
93
|
+
distribute such modifications or work under the terms of Section 1
|
|
94
|
+
above, provided that you also meet all of these conditions:
|
|
95
|
+
|
|
96
|
+
a) You must cause the modified files to carry prominent notices
|
|
97
|
+
stating that you changed the files and the date of any change.
|
|
98
|
+
|
|
99
|
+
b) You must cause any work that you distribute or publish, that in
|
|
100
|
+
whole or in part contains or is derived from the Program or any
|
|
101
|
+
part thereof, to be licensed as a whole at no charge to all third
|
|
102
|
+
parties under the terms of this License.
|
|
103
|
+
|
|
104
|
+
c) If the modified program normally reads commands interactively
|
|
105
|
+
when run, you must cause it, when started running for such
|
|
106
|
+
interactive use in the most ordinary way, to print or display an
|
|
107
|
+
announcement including an appropriate copyright notice and a notice
|
|
108
|
+
that there is no warranty (or else, saying that you provide a
|
|
109
|
+
warranty) and that users may redistribute the program under these
|
|
110
|
+
conditions, and telling the user how to view a copy of this License.
|
|
111
|
+
(Exception: if the Program itself is interactive but does not
|
|
112
|
+
normally print such an announcement, your work based on the Program
|
|
113
|
+
is not required to print an announcement.)
|
|
114
|
+
|
|
115
|
+
These requirements apply to the modified work as a whole. If
|
|
116
|
+
identifiable sections of that work are not derived from the Program,
|
|
117
|
+
and can be reasonably considered independent and separate works in
|
|
118
|
+
themselves, then this License, and its terms, do not apply to those
|
|
119
|
+
sections when you distribute them as separate works. But when you
|
|
120
|
+
distribute the same sections as part of a whole which is a work based
|
|
121
|
+
on the Program, the distribution of the whole must be on the terms of
|
|
122
|
+
this License, whose permissions for other licensees extend to the
|
|
123
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
|
124
|
+
|
|
125
|
+
Thus, it is not the intent of this section to claim rights or contest
|
|
126
|
+
your rights to work written entirely by you; rather, the intent is to
|
|
127
|
+
exercise the right to control the distribution of derivative or
|
|
128
|
+
collective works based on the Program.
|
|
129
|
+
|
|
130
|
+
In addition, mere aggregation of another work not based on the Program
|
|
131
|
+
with the Program (or with a work based on the Program) on a volume of
|
|
132
|
+
a storage or distribution medium does not bring the other work under
|
|
133
|
+
the scope of this License.
|
|
134
|
+
|
|
135
|
+
3. You may copy and distribute the Program (or a work based on it,
|
|
136
|
+
under Section 2) in object code or executable form under the terms of
|
|
137
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
|
138
|
+
|
|
139
|
+
a) Accompany it with the complete corresponding machine-readable
|
|
140
|
+
source code, which must be distributed under the terms of Sections
|
|
141
|
+
1 and 2 above on a medium customarily used for software interchange;
|
|
142
|
+
or,
|
|
143
|
+
|
|
144
|
+
b) Accompany it with a written offer, valid for at least three
|
|
145
|
+
years, to give any third party, for a charge no more than your cost
|
|
146
|
+
of physically performing source distribution, a complete
|
|
147
|
+
machine-readable copy of the corresponding source code, to be
|
|
148
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
|
149
|
+
customarily used for software interchange; or,
|
|
150
|
+
|
|
151
|
+
c) Accompany it with the information you received as to the offer
|
|
152
|
+
to distribute corresponding source code. (This alternative is
|
|
153
|
+
allowed only for noncommercial distribution and only if you
|
|
154
|
+
received the program in object code or executable form with such an
|
|
155
|
+
offer, in accord with Subsection b above.)
|
|
156
|
+
|
|
157
|
+
The source code for a work means the preferred form of the work for
|
|
158
|
+
making modifications to it. For an executable work, complete source
|
|
159
|
+
code means all the source code for all modules it contains, plus any
|
|
160
|
+
associated interface definition files, plus the scripts used to
|
|
161
|
+
control compilation and installation of the executable. However, as a
|
|
162
|
+
special exception, the source code distributed need not include
|
|
163
|
+
anything that is normally distributed (in either source or binary
|
|
164
|
+
form) with the major components (compiler, kernel, and so on) of the
|
|
165
|
+
operating system on which the executable runs, unless that component
|
|
166
|
+
itself accompanies the executable.
|
|
167
|
+
|
|
168
|
+
If distribution of executable or object code is made by offering
|
|
169
|
+
access to copy from a designated place, then offering equivalent
|
|
170
|
+
access to copy the source code from the same place counts as
|
|
171
|
+
distribution of the source code, even though third parties are not
|
|
172
|
+
compelled to copy the source along with the object code.
|
|
173
|
+
|
|
174
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
|
175
|
+
except as expressly provided under this License. Any attempt
|
|
176
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
|
177
|
+
void, and will automatically terminate your rights under this License.
|
|
178
|
+
However, parties who have received copies, or rights, from you under
|
|
179
|
+
this License will not have their licenses terminated so long as such
|
|
180
|
+
parties remain in full compliance.
|
|
181
|
+
|
|
182
|
+
5. You are not required to accept this License, since you have not
|
|
183
|
+
signed it. However, nothing else grants you permission to modify or
|
|
184
|
+
distribute the Program or its derivative works. These actions are
|
|
185
|
+
prohibited by law if you do not accept this License. Therefore, by
|
|
186
|
+
modifying or distributing the Program (or any work based on the
|
|
187
|
+
Program), you indicate your acceptance of this License to do so, and
|
|
188
|
+
all its terms and conditions for copying, distributing or modifying
|
|
189
|
+
the Program or works based on it.
|
|
190
|
+
|
|
191
|
+
6. Each time you redistribute the Program (or any work based on the
|
|
192
|
+
Program), the recipient automatically receives a license from the
|
|
193
|
+
original licensor to copy, distribute or modify the Program subject to
|
|
194
|
+
these terms and conditions. You may not impose any further
|
|
195
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
|
196
|
+
You are not responsible for enforcing compliance by third parties to
|
|
197
|
+
this License.
|
|
198
|
+
|
|
199
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
|
200
|
+
infringement or for any other reason (not limited to patent issues),
|
|
201
|
+
conditions are imposed on you (whether by court order, agreement or
|
|
202
|
+
otherwise) that contradict the conditions of this License, they do not
|
|
203
|
+
excuse you from the conditions of this License. If you cannot
|
|
204
|
+
distribute so as to satisfy simultaneously your obligations under this
|
|
205
|
+
License and any other pertinent obligations, then as a consequence you
|
|
206
|
+
may not distribute the Program at all. For example, if a patent
|
|
207
|
+
license would not permit royalty-free redistribution of the Program by
|
|
208
|
+
all those who receive copies directly or indirectly through you, then
|
|
209
|
+
the only way you could satisfy both it and this License would be to
|
|
210
|
+
refrain entirely from distribution of the Program.
|
|
211
|
+
|
|
212
|
+
If any portion of this section is held invalid or unenforceable under
|
|
213
|
+
any particular circumstance, the balance of the section is intended to
|
|
214
|
+
apply and the section as a whole is intended to apply in other
|
|
215
|
+
circumstances.
|
|
216
|
+
|
|
217
|
+
It is not the purpose of this section to induce you to infringe any
|
|
218
|
+
patents or other property right claims or to contest validity of any
|
|
219
|
+
such claims; this section has the sole purpose of protecting the
|
|
220
|
+
integrity of the free software distribution system, which is
|
|
221
|
+
implemented by public license practices. Many people have made
|
|
222
|
+
generous contributions to the wide range of software distributed
|
|
223
|
+
through that system in reliance on consistent application of that
|
|
224
|
+
system; it is up to the author/donor to decide if he or she is willing
|
|
225
|
+
to distribute software through any other system and a licensee cannot
|
|
226
|
+
impose that choice.
|
|
227
|
+
|
|
228
|
+
This section is intended to make thoroughly clear what is believed to
|
|
229
|
+
be a consequence of the rest of this License.
|
|
230
|
+
|
|
231
|
+
8. If the distribution and/or use of the Program is restricted in
|
|
232
|
+
certain countries either by patents or by copyrighted interfaces, the
|
|
233
|
+
original copyright holder who places this Program under this License
|
|
234
|
+
may add an explicit geographical distribution limitation excluding
|
|
235
|
+
those countries, so that distribution is permitted only in or among
|
|
236
|
+
countries not thus excluded. In such case, this License incorporates
|
|
237
|
+
the limitation as if written in the body of this License.
|
|
238
|
+
|
|
239
|
+
9. The Free Software Foundation may publish revised and/or new
|
|
240
|
+
versions of the General Public License from time to time. Such new
|
|
241
|
+
versions will be similar in spirit to the present version, but may
|
|
242
|
+
differ in detail to address new problems or concerns.
|
|
243
|
+
|
|
244
|
+
Each version is given a distinguishing version number. If the Program
|
|
245
|
+
specifies a version number of this License which applies to it and
|
|
246
|
+
"any later version", you have the option of following the terms and
|
|
247
|
+
conditions either of that version or of any later version published by
|
|
248
|
+
the Free Software Foundation. If the Program does not specify a
|
|
249
|
+
version number of this License, you may choose any version ever
|
|
250
|
+
published by the Free Software Foundation.
|
|
251
|
+
|
|
252
|
+
10. If you wish to incorporate parts of the Program into other free
|
|
253
|
+
programs whose distribution conditions are different, write to the
|
|
254
|
+
author to ask for permission. For software which is copyrighted by the
|
|
255
|
+
Free Software Foundation, write to the Free Software Foundation; we
|
|
256
|
+
sometimes make exceptions for this. Our decision will be guided by the
|
|
257
|
+
two goals of preserving the free status of all derivatives of our free
|
|
258
|
+
software and of promoting the sharing and reuse of software generally.
|
|
259
|
+
|
|
260
|
+
NO WARRANTY
|
|
261
|
+
|
|
262
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
263
|
+
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
264
|
+
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
265
|
+
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
|
|
266
|
+
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
267
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
268
|
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
269
|
+
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
|
270
|
+
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
271
|
+
|
|
272
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
273
|
+
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
274
|
+
AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
275
|
+
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
276
|
+
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
277
|
+
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
278
|
+
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
279
|
+
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
|
|
280
|
+
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
281
|
+
DAMAGES.
|
|
282
|
+
|
|
283
|
+
END OF TERMS AND CONDITIONS
|
|
284
|
+
|
|
285
|
+
How to Apply These Terms to Your New Programs
|
|
286
|
+
|
|
287
|
+
If you develop a new program, and you want it to be of the greatest
|
|
288
|
+
possible use to the public, the best way to achieve this is to make it
|
|
289
|
+
free software which everyone can redistribute and change under these
|
|
290
|
+
terms.
|
|
291
|
+
|
|
292
|
+
To do so, attach the following notices to the program. It is safest
|
|
293
|
+
to attach them to the start of each source file to most effectively
|
|
294
|
+
convey the exclusion of warranty; and each file should have at least
|
|
295
|
+
the "copyright" line and a pointer to where the full notice is found.
|
|
296
|
+
|
|
297
|
+
<one line to give the program's name and a brief idea of what it does.>
|
|
298
|
+
Copyright (C) <year> <name of author>
|
|
299
|
+
|
|
300
|
+
This program is free software; you can redistribute it and/or modify
|
|
301
|
+
it under the terms of the GNU General Public License as published by
|
|
302
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
303
|
+
(at your option) any later version.
|
|
304
|
+
|
|
305
|
+
This program is distributed in the hope that it will be useful,
|
|
306
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
307
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
308
|
+
GNU General Public License for more details.
|
|
309
|
+
|
|
310
|
+
You should have received a copy of the GNU General Public License
|
|
311
|
+
along with this program; if not, write to the Free Software
|
|
312
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
Also add information on how to contact you by electronic and paper mail.
|
|
316
|
+
|
|
317
|
+
If the program is interactive, make it output a short notice like this
|
|
318
|
+
when it starts in an interactive mode:
|
|
319
|
+
|
|
320
|
+
Gnomovision version 69, Copyright (C) year name of author
|
|
321
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
322
|
+
This is free software, and you are welcome to redistribute it
|
|
323
|
+
under certain conditions; type `show c' for details.
|
|
324
|
+
|
|
325
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
326
|
+
parts of the General Public License. Of course, the commands you use may
|
|
327
|
+
be called something other than `show w' and `show c'; they could even be
|
|
328
|
+
mouse-clicks or menu items--whatever suits your program.
|
|
329
|
+
|
|
330
|
+
You should also get your employer (if you work as a programmer) or your
|
|
331
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
332
|
+
necessary. Here is a sample; alter the names:
|
|
333
|
+
|
|
334
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
335
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
336
|
+
|
|
337
|
+
<signature of Ty Coon>, 1 April 1989
|
|
338
|
+
Ty Coon, President of Vice
|
|
339
|
+
|
|
340
|
+
This General Public License does not permit incorporating your program
|
|
341
|
+
into proprietary programs. If your program is a subroutine library, you
|
|
342
|
+
may consider it more useful to permit linking proprietary applications
|
|
343
|
+
with the library. If this is what you want to do, use the GNU Lesser
|
|
344
|
+
General Public License instead of this License.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/banner.jpg" alt="DSH Pocket Relay" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">DSH Pocket Relay</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><a href="README.en.md">English</a> | <a href="README.md">中文</a></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/dsh-pocket-relay"><img alt="npm" src="https://img.shields.io/npm/v/dsh-pocket-relay?color=4d6bfe&label=npm"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/dsh-pocket-relay"><img alt="downloads" src="https://img.shields.io/npm/dm/dsh-pocket-relay?color=4d6bfe"></a>
|
|
12
|
+
<a href="https://github.com/kinderao/dsh-pocket-relay/actions"><img alt="CI" src="https://github.com/kinderao/dsh-pocket-relay/actions/workflows/release.yml/badge.svg"></a>
|
|
13
|
+
<a href="LICENSE"><img alt="License: GPL-2.0" src="https://img.shields.io/badge/license-GPL--2.0-red.svg"></a>
|
|
14
|
+
<a href="https://github.com/kinderao/dsh-pocket-relay/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/kinderao/dsh-pocket-relay"></a>
|
|
15
|
+
<a href="https://awesome-dsh-plugin.com"><img alt="Awesome DSH Plugin" src="https://awesome-dsh-plugin.com/badge.svg"></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
> Put **DeepSeek Harness in your pocket**: scan a QR code on your LAN, or reach it from anywhere through the **relay on your own server** — with per-device auth and multi-PC coexistence/failover.
|
|
19
|
+
|
|
20
|
+
> Based on [shaobeichen/dsh-pocket](https://github.com/shaobeichen/dsh-pocket) (GPL-2.0). This fork replaces the cloudflared public tunnel with a **self-hosted relay** (single Go binary server + web admin), and adds device authentication and multi-PC management.
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
⭐ A Star would make the author's day · <a href="https://github.com/kinderao/dsh-pocket-relay">Here, take one</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
## What is this
|
|
27
|
+
|
|
28
|
+
**You want to use DeepSeek Harness on your computer, even when you're not at the computer.**
|
|
29
|
+
|
|
30
|
+
- On your way home, the agent is running a task on your computer — pull out your phone and see where it is, what it produced.
|
|
31
|
+
- Out and about, you want the agent on your computer to look something up or write a snippet — no remote desktop, no SSH.
|
|
32
|
+
- The computer is at home or in the office, you're elsewhere, and you want to **drive your DeepSeek Harness from your phone** — send tasks, watch the output, tap approvals.
|
|
33
|
+
|
|
34
|
+
That's what DSH Pocket does: **install it, scan a QR code, and your phone shows and controls the DeepSeek Harness UI in real time — from anywhere.**
|
|
35
|
+
|
|
36
|
+
What it looks like — the phone shows the exact same UI as your computer, live:
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<img src="docs/interface.jpg" alt="DSH UI on the phone" width="100%">
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
## ✨ Features
|
|
43
|
+
|
|
44
|
+
| Feature | Description |
|
|
45
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| 📶 LAN QR access | Works out of the box: Settings → Phone access — scan the LAN QR on the same Wi-Fi (auto-detects the LAN IP; **under WSL it picks the Windows host's physical NIC IP**) |
|
|
47
|
+
| 🚪 LAN switch | **Turn LAN access off/on with one click** in Settings (a confirmation dialog shows each time): off kills the LAN QR code and link instantly; public access is unaffected |
|
|
48
|
+
| 🌐 Public QR (from anywhere) | Click "Enable anywhere" → cloudflared tunnel → scan the public QR over 4G / any network |
|
|
49
|
+
| 🏷️ Fixed public hostname | Optional "**Named tunnel**" mode: paste a Cloudflare Tunnel Token + your own domain — the public address stays **fixed across restarts** (see below) |
|
|
50
|
+
| 🔐 Access PIN | Public links require an **8-character PIN** (rotated on every tunnel start by default; **customizable to a fixed PIN** — custom PINs are not rotated); LAN has its own separate **8-character PIN** (on by default; switchable off in Settings — then LAN scans connect directly) |
|
|
51
|
+
| 🔑 Custom PINs | Both the public and LAN PINs can be **set to your own fixed 8-character PIN (letters and digits) in Settings** (custom PINs are never auto-rotated) |
|
|
52
|
+
| 🧘 Session persistence | Enter the PIN once and you're set for a long time (login is tied to the computer's dsh web process: as long as it stays up, the phone won't ask again; **after a dsh web restart/update, enter it once more**) |
|
|
53
|
+
| ⚡ Real-time sync | Streaming output passes through WebSocket untouched — what the computer renders, the phone renders live; fully interactive both ways; built-in WS heartbeat keep-alive (defeats silent NAT/battery link drops with auto-reconnect) |
|
|
54
|
+
| 📱 Mobile-adaptive layout | Narrow screens get a drawer layout automatically (ported from dsh-web-mobile, MIT): sidebar drawer, full-width conversation, safe-area insets, touch optimizations |
|
|
55
|
+
| 📁 File browser | The mobile "Files" entries need a host-side explorer panel (a dsh-web-ui component); on stock DSH without it the entries are auto-hidden instead of doing nothing |
|
|
56
|
+
| 🗜️ Transfer compression | Large JSON responses are gzip/brotli'd on the fly (17MB session history → ~1MB; brotli quality 6: fast and bandwidth-friendly) — faster loads, less mobile data |
|
|
57
|
+
| 🔁 Tunnel auto-restore | After a DSH restart the previously-running public tunnel comes back automatically |
|
|
58
|
+
| 🧩 Zero-dependency install | One npm package, one settings tab — no core/adapter split, no account, no server |
|
|
59
|
+
|
|
60
|
+
## 🚀 Usage
|
|
61
|
+
|
|
62
|
+
**Where the entry is**: after installing and restarting `dsh web`, open **Settings** — the left sidebar shows **"Phone access"** at the top level (same level as General / Models):
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<img src="docs/entry.jpg" alt="Phone access entry" width="70%">
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
**Prerequisite**: [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) installed. If your terminal says `dsh: command not found`, install it first:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm install -g @deepseek-ai/dsh # global install; verify: dsh --version
|
|
72
|
+
# No global install? Prefix every command with: npx @deepseek-ai/dsh
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
# 1. Install the plugin (everything in one package)
|
|
77
|
+
dsh plugin --profile web add dsh-pocket-relay -w
|
|
78
|
+
|
|
79
|
+
# 2. Restart dsh web
|
|
80
|
+
npx @deepseek-ai/dsh web
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### LAN (same Wi-Fi)
|
|
84
|
+
|
|
85
|
+
Settings → **Phone access** → scan the "📶 LAN" QR code → enter the **LAN PIN** (shown in the LAN block; hit **Refresh** to roll a new one, or **Customize** to set your own fixed 8 digits) → the phone opens the exact same DSH, in real time.
|
|
86
|
+
|
|
87
|
+
> The "**LAN access**" switch is **on by default** and can be **turned off/on with one click** (a confirmation dialog shows each time). Off kills the LAN QR code and link instantly (phones can't open them); **public access is unaffected**. Tap "On" to restore it.
|
|
88
|
+
>
|
|
89
|
+
> The LAN PIN is **on by default** (security-first). If you're the only user and find typing it every time annoying, flip "LAN access PIN" to **Off** in the LAN block — LAN scans then connect directly with no PIN (LAN-only devices; the **public tunnel always requires a PIN**, unaffected).
|
|
90
|
+
>
|
|
91
|
+
> After logging in once, the phone **won't ask again**: as long as the computer's dsh web keeps running, reopening the phone needs no PIN (**a dsh web restart/update asks for it once more**).
|
|
92
|
+
>
|
|
93
|
+
> Advanced option: auto-detection may not pick a reachable address for Tailscale/VPN setups. You can select a detected IP from the "LAN address" dropdown; normally no change is needed.
|
|
94
|
+
|
|
95
|
+
### Public (from anywhere)
|
|
96
|
+
|
|
97
|
+
On the same page click "**Enable anywhere**" → **a security disclaimer pops up every time — check "I understand and agree" to proceed** (on a corporate/classified network, confirm compliance first) → wait for the tunnel (first run downloads cloudflared; macOS/Linux use the Tsinghua mirror, seconds) → scan the "🌐 Public" QR code → the phone opens the link and **enters the 8-character PIN** (shown in the settings page's public section; **rotated on every tunnel start by default**, or **Customize** it to a fixed PIN — letters and digits — that is never rotated) → works from outside (4G / office network).
|
|
98
|
+
|
|
99
|
+
> Upgrading: `dsh plugin --profile web update dsh-pocket-relay --latest -w` (`--latest` is required across major versions — a `^0.x` range won't auto-jump to 1.x).
|
|
100
|
+
|
|
101
|
+
### Fixed public hostname (named tunnel, optional)
|
|
102
|
+
|
|
103
|
+
The default "quick tunnel" gets a new random URL on every restart. For a **fixed public address**, use a Cloudflare **named tunnel** (requires a Cloudflare account + your own domain):
|
|
104
|
+
|
|
105
|
+
1. In [Cloudflare Zero Trust](https://one.dash.cloudflare.com/) → **Networks → Tunnels**, create a Tunnel and copy the **Tunnel Token**
|
|
106
|
+
2. In that Tunnel's **Public Hostname**, point your domain (e.g. `pocket.example.com`) to `http://127.0.0.1:3081`
|
|
107
|
+
3. Back in the settings page's public section: switch the mode to "**Named tunnel**", paste the Tunnel Token, enter the fixed hostname, and save
|
|
108
|
+
4. Click "Enable anywhere" → the public address is now your own hostname and **survives restarts**
|
|
109
|
+
|
|
110
|
+
Note: in named-tunnel mode the public PIN is **not auto-rotated** (the address is fixed, so the PIN stays the same across restarts) — manage it proactively with a custom PIN. The Tunnel Token is stored locally only (`$DSH_HOME/dsh-pocket/settings.json`, readable by your user only) and is never echoed back in the UI.
|
|
111
|
+
|
|
112
|
+
## ⚠️ Security (read first)
|
|
113
|
+
|
|
114
|
+
- **DSH can execute code on your computer.** **LAN** QR/URL plus its own **8-character PIN** is the key (PIN **on by default**, switchable off — then LAN scans connect directly, same-network devices only) — **never share the LAN QR, URL or PIN**.
|
|
115
|
+
- **Read and accept the security disclaimer before enabling public access** (the dialog shows on every enable; the server enforces it, so it can't be bypassed): public = exposing a code-executing DSH to the internet — use a strong PIN, turn it off when done, never on classified networks.
|
|
116
|
+
- **Public** access is protected by an **8-character PIN**: the link is random, the PIN rotates on every tunnel start by default, and old links die instantly — even a leaked link can't get in. **A custom PIN is never auto-rotated** (your value stays stable; custom PINs may use letters and digits).
|
|
117
|
+
- Phone login state is tied to the computer's dsh web process: **no re-entry while dsh web stays up; one re-entry after a restart/update**.
|
|
118
|
+
- **Login rate limiting** (anti brute-force): **5** consecutive wrong PINs from the same IP lock it for **60s**; a global failure threshold briefly locks everyone (blocks distributed IP-rotation scans); a successful login resets the counter.
|
|
119
|
+
- The public URL is randomly assigned by cloudflared and **changes on every restart** (old links die automatically — a natural key rotation); in **named-tunnel fixed-hostname** mode the address stays and the PIN is not auto-rotated — manage it with a custom PIN.
|
|
120
|
+
- **Public detection is fail-closed** (issue #66): everything except loopback and private LAN addresses is treated as **public and PIN-gated** — including any self-hosted tunnel / reverse proxy pointing at the local port with its own hostname. There is no "change the domain to bypass the PIN" hole.
|
|
121
|
+
- LAN mode exposes nothing publicly; only devices on the same network can reach it.
|
|
122
|
+
- Built for personal use; the public PIN lives in `$DSH_HOME/dsh-pocket/token` (re-rolled per tunnel start unless customized), the LAN PIN in `$DSH_HOME/dsh-pocket/token-lan` (refreshed manually in Settings), and switches/custom flags in `$DSH_HOME/dsh-pocket/settings.json`.
|
|
123
|
+
|
|
124
|
+
## 💻 DSH Desktop
|
|
125
|
+
|
|
126
|
+
- In the desktop app, **QR screen-mirroring works**; **update/restart are managed by the desktop app** (auto-disabled here).
|
|
127
|
+
- ⚠️ The desktop **advanced mode** doesn't support phone access yet (it disables the web layout; the phone gets no layout service → blank screen). Switch back to **compatibility** mode and restart; phones opening an advanced-mode page will see a clear notice overlay.
|
|
128
|
+
|
|
129
|
+
## 🩹 Troubleshooting (traps users step on)
|
|
130
|
+
|
|
131
|
+
| Symptom | Cause & fix |
|
|
132
|
+
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| `dsh: command not found` / "DSH is not defined" | dsh CLI missing: `npm install -g @deepseek-ai/dsh`, or prefix commands with `npx @deepseek-ai/dsh` |
|
|
134
|
+
| `ERR_PNPM_ADDING_TO_ROOT` | pnpm 9 workspace-root restriction: append `-w` (`--workspace-root`) to install/update commands |
|
|
135
|
+
| Nothing changed after install/update | **You must restart `dsh web`**; the running process still loads the old code |
|
|
136
|
+
| `listen EADDRINUSE ... :3081` | A stale dsh-pocket-relay process holds the port: macOS/Linux `lsof -ti :3081 \| xargs kill -9`; Windows `netstat -ano \| findstr :3081` (find the LISTENING PID) → `taskkill /PID <PID> /F`, then retry |
|
|
137
|
+
| Want a different port (issue #70) | Plugin mode: write `"proxyPort": 3082` into `$DSH_HOME/dsh-pocket/settings.json` and restart `dsh web`. CLI mode: `dsh-pocket-relay --port 3082`. If the port is taken you'll get `EADDRINUSE` — kill the old process or pick another one |
|
|
138
|
+
| Issue a temporary PIN to a guest | Not available: the temporary access PIN feature (issue #69) was removed in 2.6.x (it crashed on revoke). To share access, send the main PIN or a `?token=<main PIN>` link, then hit "Refresh" in Settings once the guest is done |
|
|
139
|
+
| cloudflared install fails on a remote Linux server (issue #45) | If all CDN sources (GitHub / ghproxy / gh.ddlc / gh-proxy) are unreachable on a remote Linux host, install `cloudflared` yourself (e.g. `apt install cloudflared`, `dnf install cloudflared`, or download the tgz and unpack it), then add `"cloudflaredPath": "/path/to/cloudflared"` into `$DSH_HOME/dsh-pocket/settings.json` and restart `dsh web`. The plugin will then use that binary directly and skip the auto-download |
|
|
140
|
+
| Version stuck below 1.x | `^0.x` ranges never jump to 1.x: update with `--latest` (`dsh plugin --profile web update dsh-pocket-relay --latest -w`) |
|
|
141
|
+
| Public `error 1033` | See "Public tunnel troubleshooting" below — usually a local proxy/VPN (Clash etc. TUN mode) killing the tunnel |
|
|
142
|
+
| After "Restart dsh web", the page says the process is running in the background | The new process from in-page self-restart is a detached background process (not attached to your terminal) — that's the standard way to apply updates in-page; stop it: macOS/Linux `lsof -ti :3080 \| xargs kill -9`; Windows `netstat -ano \| findstr :3080` → `taskkill /PID <PID> /F` (logs under `$DSH_HOME` as `dsh-pocket-restart-*.log`) |
|
|
143
|
+
|
|
144
|
+
## ⚠️ Public tunnel troubleshooting (read first)
|
|
145
|
+
|
|
146
|
+
**Symptom**: after clicking "Enable anywhere", the public URL shows `error 1033` (Tunnel error) on the phone.
|
|
147
|
+
|
|
148
|
+
**Most common cause: a local proxy/VPN (Clash, Surge, v2ray, sing-box, etc., especially in TUN mode).**
|
|
149
|
+
Such tools take over all traffic and often cut cloudflared's tunnel-edge connections
|
|
150
|
+
(`*.argotunnel.com`, Cloudflare edge IPs), so the tunnel registers but the data plane never connects.
|
|
151
|
+
|
|
152
|
+
**Fix (try in order, lightest first)**:
|
|
153
|
+
|
|
154
|
+
1. First **just turn off the proxy's TUN mode** — no need to quit the proxy; this is enough in most cases:
|
|
155
|
+
- Clash: turn off the "**TUN mode**" toggle in Settings (or right-click the menu-bar icon → uncheck TUN mode)
|
|
156
|
+
- Surge: turn off "**Enhanced mode**"; v2ray/sing-box: turn off "**virtual NIC / route takeover**"
|
|
157
|
+
- Then go back to the settings page and click "Enable anywhere" again
|
|
158
|
+
2. If that's not enough, temporarily **fully quit the proxy** (not just close the window: quit Clash from the menu-bar icon; if a
|
|
159
|
+
background service is installed, stop it in the service manager and confirm with `ps aux | grep clash`), then retry.
|
|
160
|
+
3. Add **DIRECT rules** to the proxy for the tunnel domains and Cloudflare edge (Clash example):
|
|
161
|
+
```yaml
|
|
162
|
+
- DOMAIN-SUFFIX,argotunnel.com,DIRECT
|
|
163
|
+
- DOMAIN-SUFFIX,trycloudflare.com,DIRECT
|
|
164
|
+
- IP-CIDR,198.41.192.0/24,DIRECT,no-resolve
|
|
165
|
+
```
|
|
166
|
+
4. If the network really can't reach the tunnel, use **LAN mode**: turn on the phone hotspot → connect the computer to it → scan the LAN QR. Same experience, from anywhere.
|
|
167
|
+
|
|
168
|
+
**Other causes**: corporate firewalls / campus networks blocking outbound — ask IT to allow it, or use a hotspot.
|
|
169
|
+
|
|
170
|
+
**First run: "Downloading cloudflared" fails or hangs**:
|
|
171
|
+
|
|
172
|
+
- **macOS/Linux**: the plugin first downloads from the **Tsinghua mirror** (measured ~3MB/s, done in seconds); falls back to official GitHub + acceleration mirrors if it fails.
|
|
173
|
+
- **Windows**: no Tsinghua mirror (Homebrew doesn't support Windows) — downloads the ~50MB exe from GitHub directly; **single-threaded, so it's slower — that's expected**, wait a few minutes, or use a proxy.
|
|
174
|
+
- If all sources fail, the settings page shows a hint. Alternatives (any one):
|
|
175
|
+
|
|
176
|
+
1. Install the `cloudflared` command and retry (the plugin then uses the PATH binary, no download):
|
|
177
|
+
- macOS: `brew install cloudflared`; Linux: `sudo apt install cloudflared` or from the official site
|
|
178
|
+
- Windows: `winget install cloudflared` or from the official site
|
|
179
|
+
- Any platform: `npm i -g cloudflared`
|
|
180
|
+
2. Enable a proxy (system proxy / Clash etc.) and click "Enable anywhere" again
|
|
181
|
+
3. Manually download the binary into `$DSH_HOME/dsh-pocket/bin/` (`$DSH_HOME` is usually `~/.dsh`, on Windows `%USERPROFILE%\.dsh`; name it `cloudflared` (add `.exe` on Windows) **or** the release asset name — both are recognized)
|
|
182
|
+
|
|
183
|
+
## 🗂 Architecture (single package)
|
|
184
|
+
|
|
185
|
+
| File | Purpose |
|
|
186
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `lib/index.js` | Plugin entry: auto-start proxy + register RPC + access-PIN management (public: 8 digits rotated per tunnel start; LAN: separate 8 digits, manually refreshable / switchable) + LAN access switch + DSH Desktop detection |
|
|
188
|
+
| `lib/settings.mjs` | Settings persistence: LAN access switch (on by default) + LAN-PIN switch (on by default) stored in `$DSH_HOME/dsh-pocket/settings.json` |
|
|
189
|
+
| `lib/service.mjs` | Service: proxy lifecycle (port auto-fallback), public tunnel (auto-restore), status snapshot (with QR data URLs) |
|
|
190
|
+
| `lib/proxy.mjs` | Header-rewriting reverse proxy: Host/Origin → loopback, HTTP + WebSocket passthrough + polyfill injection + gzip/brotli compression + per-host token auth (public always; LAN per switch) + blocks LAN Hosts when LAN is off |
|
|
191
|
+
| `lib/tunnel.mjs` | cloudflared: multi-mirror download (Tsinghua first) / adaptive parallel / start / parse public URL (HTTP/2) |
|
|
192
|
+
| `lib/web-rpc.js` | Loopback RPC: `status` / `tunnel.start` / `tunnel.stop` / `lan.setEnabled` / `version` / `update` / `restart` |
|
|
193
|
+
| `client/` | "Phone access" settings tab + mobile adaptation (dsh-web-mobile port) |
|
|
194
|
+
| `bin/dsh-pocket-relay.mjs` | CLI: LAN/public modes, prints URL + QR |
|
|
195
|
+
|
|
196
|
+
## 🛠 Development
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
npm install
|
|
200
|
+
node client/build.mjs # rebuild after editing client/
|
|
201
|
+
npm test # proxy / auth / compression / tunnel / service / RPC / settings (109 tests)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Want to try your changes locally without publishing?** Point the installed plugin at your local checkout with a symlink and restart dsh web. Full steps (including switching back to the npm release) are in [LOCAL-DEV.md](./LOCAL-DEV.md).
|
|
205
|
+
|
|
206
|
+
## 🤝 Credits
|
|
207
|
+
|
|
208
|
+
- Mobile adaptation ported from [mexiaosqwq/dsh-web-mobile](https://github.com/mexiaosqwq/dsh-web-mobile) (MIT)
|
|
209
|
+
- Public tunnel powered by [cloudflared](https://github.com/cloudflare/cloudflared)
|
|
210
|
+
|
|
211
|
+
## 📄 License
|
|
212
|
+
|
|
213
|
+
[GPL-2.0](LICENSE) — copyleft: free to use, modify, and redistribute, but **derivatives must stay GPL** and keep the copyright notice; commercial use included.
|
|
214
|
+
|
|
215
|
+
> Note: the mobile-adaptation portion is ported from [dsh-web-mobile](https://github.com/mexiaosqwq/dsh-web-mobile) (MIT, GPL-compatible); its copyright notice stays in `client/mobile/LICENSE.dsh-web-mobile`.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
**Questions? Feedback welcome**: bugs, ideas, or feature requests — open an issue at [GitHub Issues](https://github.com/kinderao/dsh-pocket-relay/issues) 🙏
|