Check-in [5a0865b281]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Start adding id to GUI entry screen
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a0865b2815287da1bcb2ac663f9e865af08e3e0
User & Date: bernd 2018-12-21 22:18:12
Context
2018-12-21
23:42
Start adding id to GUI entry screen check-in: 7d8d309396 user: bernd tags: trunk
22:18
Start adding id to GUI entry screen check-in: 5a0865b281 user: bernd tags: trunk
2018-12-20
12:44
Bump version number check-in: b13dfe3b17 user: bernd tags: trunk, 0.8.5-20181220
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to gui.fs.

91
92
93
94
95
96
97





98
99
100
101
102
103
104
...
118
119
120
121
122
123
124





125
126
127
128
129
130
131
...
172
173
174
175
176
177
178
179
180
181
182
183
184

















185
186
187
188
189
190
191
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226


























227
228
229


230




231
232
233
234
235
236
237
238
...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
...
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
...
667
668
669
670
671
672
673

674
675
676
677
678
679
680
...
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
...
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
0 Value id-frame
0 Value chat-frame

\ password screen

0 Value pw-err
0 Value pw-num






: err-fade ( r addr -- )
    1e fover [ pi f2* ] Fliteral f* fcos 1e f+ f2/ f-
    2 tries# @ lshift s>f f* fdup 1e f> IF fdrop 1e ELSE +sync +resize THEN
    .fade fdrop ;

: shake-lr ( r addr -- )
................................................................................
	o anims[] >stack o>
    LOOP  flag ;

forward show-nicks
forward gui-msgs
0 Value title-vp






: pw-done ( max span addr pos -- max span addr pos flag )
    err-fade? IF  false  EXIT  THEN
    over 3 pick >passphrase +key
    read-keys secret-keys# 0= IF
	\ ." Wrong passphrase" cr
	1 tries# +! tries# @ 0 <# #s #> pw-num >o to text$ o>
	keys sec[]free
................................................................................
glue*lll± >o 1Mglue fnip 1000e fswap hglue-c glue! 0glue fnip 1filll fswap dglue-c glue! 1glue vglue-c glue! o>

glue new Constant glue*shrink
glue*shrink >o 0e 1filll 0e hglue-c glue! 1glue dglue-c glue! 1glue vglue-c glue! o>

{{ login-bg-col# pres-frame dark-blue# ' dark-blue >body f!
    {{
	glue*lll± }}glue
	' net2o-logo "doc/net2o.png" 0.666e }}image-file Constant net2o-glue /center
	1 ms \ dummy wait
	!i18n l" net2o GUI" /title
	!lit
	{{

















	    glue*lll }}glue
	    glue-sleft }}glue
	    {{
		\large \sans "🔐" }}text
		\large pw-num-col# to x-color s" " }}text
		25%b dup to pw-num /center
	    }}z
................................................................................
		}}h
		blackish
		{{
		    {{
			pw-text-col# to x-color
			"" }}pw dup Value pw-field
			25%b >o config:passmode# @ to pw-mode o o>
			glue*l }}glue
		    }}h
		    pw-field ' pw-done edit[]
		    {{
			\large \sans $FFFFFFFF text-color, to x-color "👁" }}text
			\normal \bold show-sign-color# to x-color "\" }}text dup value show-pw-sign /center blackish
		    }}z \regular
		    : pw-show/hide ( flag -- )
			dup IF  0 text-color,  ELSE  show-sign-color#  THEN  show-pw-sign >o to text-color o>
			2 config:passmode# @ 1 min rot select pw-field >o to pw-mode o>
			pw-field engage +sync ;
		    ' pw-show/hide config:passmode# @ 1 > toggle[]
		    \normal
		}}h box[]
	    }}z box[]


























	    glue-sright }}glue
	    glue*lll }}glue
	}}h box[] \skip >bl


	!i18n l" Enter passphrase to unlock" /subtitle !lit




	glue*lll }}glue
    }}v box[]
}}z box[] to pw-frame

$0000BFFF text-color, ' dark-blue >body f!

\ id frame

................................................................................
[IFUNDEF] child+
    : child+ ( o -- ) o over >o to parent-w o> childs[] >stack ;
[THEN]

Create ke-imports#rgb

Create imports#rgb-bg
$33EE33FF , \ myself is pretty green
$BBDD66FF , \ manually imported is green, too
$55DD55FF , \ scanned is more green
$CCEE55FF , \ seen in chat is more yellow
$EECC55FF , \ imported from DHT is pretty yellow
$FF8844FF , \ invited is very yellow
$FF6600FF , \ provisional is very orange
$FF0000FF , \ untrusted is last
Create imports#rgb-fg
$003300FF ,
$000000FF ,
$000000FF ,
$000000FF ,
$0000FFFF ,
$0000FFFF ,
$0000FFFF ,
$00FFFFFF ,

: nick[] ( box o:nick -- box )
    [: data >o ." clicked on " ke-nick $. cr o> ;] o click[] ;

: show-nick ( o:key -- )
    ke-imports @ >im-color# cells { ki }
    {{ glue*l imports#rgb-bg ki + @ color, slide-frame dup .button1
	{{
	    {{ \large imports#rgb-fg ki + @ color, to x-color
		ke-sk sec@ nip IF  \bold  ELSE  \regular  THEN  \sans
		['] .nick-base $tmp }}text 25%b
		ke-pets[] $[]# IF
		    {{ glue*l $00FF0020 color, slide-frame dup .button3
			['] .pet-base $tmp }}text 25%b
		    }}z
		THEN
................................................................................
	pk key| last-bubble-pk $!  otr to last-otr?  text-color!
	{{
	    {{ glue*l }}glue
		{{ \sans \normal
		    {{
			glue*l }}glue
			\bold pk ['] .key-id $tmp }}text 25%b
			>o imports#rgb-fg last-ki >im-color# cells + @
			color, to text-color
			o o> me? IF  swap  THEN
			\regular
		    }}h
		    glue*l imports#rgb-bg last-ki >im-color# cells + @
		    color, slide-frame dup .button2
		    swap
		}}z me? 0= IF  chatname-tab  THEN
	    }}v
	    {{
		glue*l $000000FF $FFFFFFFF last-otr? select
		color, slide-frame dup me? IF .rbubble ELSE .lbubble THEN
		"bubble" name!
................................................................................

: chat-edit-enter ( o:edit-w -- )
    text$ dup IF  do-chat-cmd? 0= IF  avalanche-text  THEN
    ELSE  2drop  THEN
    64#-1 line-date 64!  $lastline $free ;

\ +db click( \ )


{{ $80FFFFFF color, pres-frame
    {{
	{{
	    glue*l $000000FF color, slide-frame dup .button1
	    {{
		\large whitish
................................................................................
}}h box[]
Value n2o-frame

\ top widgets

: !widgets ( -- )
    top-widget .htop-resize
    top-widget .htop-resize
    pw-field engage
    1e ambient% sf! set-uniforms ;

: net2o-gui ( -- )
    n2o-frame to top-widget
    "PASSPHRASE" getenv 2dup d0= IF  2drop
    ELSE
................................................................................
lang:en include-locale lang/en

: ??lang ( addr u -- )
    ['] lang >body find-name-in ?dup-IF  execute  THEN ;

s" LANG" getenv '_' $split 2swap ??lang '.' $split ??lang ??lang

lsids .lsids

[IFDEF] load-cov  load-cov [THEN]

0 [IF]
Local Variables:
forth-local-words:
    (







>
>
>
>
>







 







>
>
>
>
>







 







|

<



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|













|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>
|
>
>
>
>
|







 







|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|





|
|

|







 







|
|



|
|







 







>







 







<







 







|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
...
182
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
...
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
...
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
...
785
786
787
788
789
790
791

792
793
794
795
796
797
798
...
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
0 Value id-frame
0 Value chat-frame

\ password screen

0 Value pw-err
0 Value pw-num
0 Value phrase-unlock
0 Value create-new-id
0 Value plus-login
0 Value minus-login
0 Value nick-edit

: err-fade ( r addr -- )
    1e fover [ pi f2* ] Fliteral f* fcos 1e f+ f2/ f-
    2 tries# @ lshift s>f f* fdup 1e f> IF fdrop 1e ELSE +sync +resize THEN
    .fade fdrop ;

: shake-lr ( r addr -- )
................................................................................
	o anims[] >stack o>
    LOOP  flag ;

forward show-nicks
forward gui-msgs
0 Value title-vp

Variable nick$

: nick-done ( max span addr pos -- max span addr pos flag )
    over 3 pick nick$ $! true ;

: pw-done ( max span addr pos -- max span addr pos flag )
    err-fade? IF  false  EXIT  THEN
    over 3 pick >passphrase +key
    read-keys secret-keys# 0= IF
	\ ." Wrong passphrase" cr
	1 tries# +! tries# @ 0 <# #s #> pw-num >o to text$ o>
	keys sec[]free
................................................................................
glue*lll± >o 1Mglue fnip 1000e fswap hglue-c glue! 0glue fnip 1filll fswap dglue-c glue! 1glue vglue-c glue! o>

glue new Constant glue*shrink
glue*shrink >o 0e 1filll 0e hglue-c glue! 1glue dglue-c glue! 1glue vglue-c glue! o>

{{ login-bg-col# pres-frame dark-blue# ' dark-blue >body f!
    {{
	{{ glue*lll± }}glue }}v
	' net2o-logo "doc/net2o.png" 0.666e }}image-file Constant net2o-glue /center

	!i18n l" net2o GUI" /title
	!lit
	{{
	    {{
		glue*ll }}glue
		\large "👤" }}text \normal
		{{
		    glue*l pw-bg-col# font-size# f2/ f2/ }}frame dup .button3
		    {{
			nt
			pw-text-col# to x-color
			"nick" }}edit 25%b dup Value nick-field
			glue*lll }}glue
		    }}h bx-tab nick-field ' nick-done edit[]
		}}z box[] blackish
		{{ \large "👤" }}text \normal }}h /phantom
		glue*ll }}glue
	    }}h box[]
	}}v box[] /vflip dup to nick-edit
	{{
	    glue*lll }}glue
	    glue-sleft }}glue
	    {{
		\large \sans "🔐" }}text
		\large pw-num-col# to x-color s" " }}text
		25%b dup to pw-num /center
	    }}z
................................................................................
		}}h
		blackish
		{{
		    {{
			pw-text-col# to x-color
			"" }}pw dup Value pw-field
			25%b >o config:passmode# @ to pw-mode o o>
			glue*lll }}glue
		    }}h
		    pw-field ' pw-done edit[]
		    {{
			\large \sans $FFFFFFFF text-color, to x-color "👁" }}text
			\normal \bold show-sign-color# to x-color "\" }}text dup value show-pw-sign /center blackish
		    }}z \regular
		    : pw-show/hide ( flag -- )
			dup IF  0 text-color,  ELSE  show-sign-color#  THEN  show-pw-sign >o to text-color o>
			2 config:passmode# @ 1 min rot select pw-field >o to pw-mode o>
			pw-field engage +sync ;
		    ' pw-show/hide config:passmode# @ 1 > toggle[]
		    \normal
		}}h box[]
	    }}z box[] bx-tab
	    {{
		\large
		"🔴" }}text \normal  >o font-size# 10% f* to raise o o>
		$000000FF dup text-emoji-color, to x-color
		"➕" }}text /center dup to plus-login
		"➖" }}text /center dup to minus-login /vflip
		\large
		: id-show-hide ( flag -- )
		    IF
			phrase-unlock /hflip
			create-new-id /flop
			plus-login /flip
			minus-login /flop
			nick-edit /flop
			[ x-baseline ] FLiteral nick-edit >o
			fdup gap% f* to gap to baseline o>
		    ELSE
			phrase-unlock /flop
			create-new-id /hflip
			plus-login /flop
			minus-login /flip
			nick-edit /vflip
			0e nick-edit >o to baseline o>
		    THEN +resize +lang ;
		\normal
	    }}z ' id-show-hide false toggle[]
	    glue-sright }}glue
	    glue*lll }}glue
	}}h box[] \skip >bl
	{{  \small
	    glue*ll }}glue
	    !i18n l" Enter passphrase to unlock" /subtitle !lit dup to phrase-unlock
	    !i18n l" Create new ID" /subtitle !lit /hflip dup to create-new-id
	    !i18n l" Enter passphrase again" /subtitle !lit /hflip dup to create-new-id
	    glue*ll }}glue
	}}h box[] >bl
	{{ glue*lll }}glue }}v
    }}v box[]
}}z box[] to pw-frame

$0000BFFF text-color, ' dark-blue >body f!

\ id frame

................................................................................
[IFUNDEF] child+
    : child+ ( o -- ) o over >o to parent-w o> childs[] >stack ;
[THEN]

Create ke-imports#rgb

Create imports#rgb-bg
$33EE33FF color, sf, \ myself is pretty green
$BBDD66FF color, sf, \ manually imported is green, too
$55DD55FF color, sf, \ scanned is more green
$CCEE55FF color, sf, \ seen in chat is more yellow
$EECC55FF color, sf, \ imported from DHT is pretty yellow
$FF8844FF color, sf, \ invited is very yellow
$FF6600FF color, sf, \ provisional is very orange
$FF0000FF color, sf, \ untrusted is last
Create imports#rgb-fg
$003300FF color, sf,
$000000FF color, sf,
$000000FF color, sf,
$000000FF color, sf,
$0000FFFF color, sf,
$0000FFFF color, sf,
$0000FFFF color, sf,
$00FFFFFF color, sf,

: nick[] ( box o:nick -- box )
    [: data >o ." clicked on " ke-nick $. cr o> ;] o click[] ;

: show-nick ( o:key -- )
    ke-imports @ >im-color# sfloats { ki }
    {{ glue*l imports#rgb-bg ki + sf@ slide-frame dup .button1
	{{
	    {{ \large imports#rgb-fg ki + sf@ to x-color
		ke-sk sec@ nip IF  \bold  ELSE  \regular  THEN  \sans
		['] .nick-base $tmp }}text 25%b
		ke-pets[] $[]# IF
		    {{ glue*l $00FF0020 color, slide-frame dup .button3
			['] .pet-base $tmp }}text 25%b
		    }}z
		THEN
................................................................................
	pk key| last-bubble-pk $!  otr to last-otr?  text-color!
	{{
	    {{ glue*l }}glue
		{{ \sans \normal
		    {{
			glue*l }}glue
			\bold pk ['] .key-id $tmp }}text 25%b
			>o imports#rgb-fg last-ki >im-color# sfloats + sf@
			to text-color
			o o> me? IF  swap  THEN
			\regular
		    }}h
		    glue*l imports#rgb-bg last-ki >im-color# sfloats + sf@
		    slide-frame dup .button2
		    swap
		}}z me? 0= IF  chatname-tab  THEN
	    }}v
	    {{
		glue*l $000000FF $FFFFFFFF last-otr? select
		color, slide-frame dup me? IF .rbubble ELSE .lbubble THEN
		"bubble" name!
................................................................................

: chat-edit-enter ( o:edit-w -- )
    text$ dup IF  do-chat-cmd? 0= IF  avalanche-text  THEN
    ELSE  2drop  THEN
    64#-1 line-date 64!  $lastline $free ;

\ +db click( \ )
\ +db gui( \ )

{{ $80FFFFFF color, pres-frame
    {{
	{{
	    glue*l $000000FF color, slide-frame dup .button1
	    {{
		\large whitish
................................................................................
}}h box[]
Value n2o-frame

\ top widgets

: !widgets ( -- )
    top-widget .htop-resize

    pw-field engage
    1e ambient% sf! set-uniforms ;

: net2o-gui ( -- )
    n2o-frame to top-widget
    "PASSPHRASE" getenv 2dup d0= IF  2drop
    ELSE
................................................................................
lang:en include-locale lang/en

: ??lang ( addr u -- )
    ['] lang >body find-name-in ?dup-IF  execute  THEN ;

s" LANG" getenv '_' $split 2swap ??lang '.' $split ??lang ??lang

\ lsids .lsids

[IFDEF] load-cov  load-cov [THEN]

0 [IF]
Local Variables:
forth-local-words:
    (

Changes to lang/de.

1
2
3
4
5
6


7
8
9
10
11
12
13
14
Gforth
🔵
⚪
net2o GUI
Falsche Passphrase
Zum Öffnen Passphrase eingeben


Spitznamen
Öffentlicher Schlüssel
Schlüsselsignaturdatum
Meine Schlüssel
Meine Gruppen
Meine Freunde
Plaudertagebuch
Senden






>
>








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Gforth
🔵
⚪
net2o GUI
Falsche Passphrase
Zum Öffnen Passphrase eingeben
Erzeuge neue ID
Passphrase nochmal eingeben
Spitznamen
Öffentlicher Schlüssel
Schlüsselsignaturdatum
Meine Schlüssel
Meine Gruppen
Meine Freunde
Plaudertagebuch
Senden

Changes to lang/en.

1
2
3
4
5
6


7
8
9
10
11
12
13
14
Gforth
🔵
⚪
net2o GUI
Wrong passphrase!
Enter passphrase to unlock


Nick+Pet
Public key
Key signature date
My keys
My groups
My peers
chat log
send






>
>








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Gforth
🔵
⚪
net2o GUI
Wrong passphrase!
Enter passphrase to unlock
Create new ID
Enter passphrase again
Nick+Pet
Public key
Key signature date
My keys
My groups
My peers
chat log
send

Changes to lang/zh.

1
2
3
4
5


6
7
8
9
10
11
12
13
14
Gforth
🔵
⚪
net2o 图形用户界面
错误的密码


输入密码以解锁
昵称
公钥
关键签名日期
我的钥匙
我的集团
我的朋友
聊天记录
发送





>
>









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Gforth
🔵
⚪
net2o 图形用户界面
错误的密码
创建新的ID
再次输入密码
输入密码以解锁
昵称
公钥
关键签名日期
我的钥匙
我的集团
我的朋友
聊天记录
发送