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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions desk/app/channel-client.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@
++ add-poast
|= [aye=(unit index) i=(unit @t) m=(list content) p=@p b=@tas]
^- (quip card _state)
|^
?> &((check-pic-length i) (check-post-length m))
=, enjs:format
?~ i
:_ state
Expand All @@ -456,5 +458,20 @@
:^ %give %fact ~[/website]
json+!>((frond 'status-msg' s+'Poast Sent...'))
==
++ check-pic-length
|= i=(unit @t)
?~(i %.y (gte 5.001 (met 3 u.i)))
++ check-post-length
|= l=(list content)
%+ gte 5.001
%+ roll l
|= [c=content u=@ud]
?+ -.c !!
%text (add u (met 3 +.c))
%mention u
%reference u
%url (add u (met 3 +.c))
==
--
--
--
102 changes: 53 additions & 49 deletions desk/app/channel-server.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
==
=. contents.wat
(auto-jannie:moot contents.wat)
:: todo - banned word parsing
:: todo - banned site parsing
=+ new=(add now.bowl ~s2)
=+ who=(src-in:moot src.bowl)
Expand All @@ -93,7 +92,7 @@
:~ :^ %pass /chan/post/(scot %da new) %agent
:^ [our.bowl %graph-push-hook] %poke %graph-update-3
!> ^- update
[(add now.bowl ~s2) [%add-nodes [our.bowl board.wat] poast]]
[new [%add-nodes [our.bowl board.wat] poast]]
==
::
=- %- my
Expand Down Expand Up @@ -260,12 +259,12 @@
banned-words+a+(turn ~(tap in words.banned) |=(@t s++<))
banned-sites+a+(turn ~(tap in sites.banned) |=(@t s++<))
::
bounty+(pairs ~[only+b+only.bounty which+s+which.bounty])
bounty+(pairs only+b+only.bounty which+s+which.bounty ~)
boards+(pairs (turn ~(tap by boards) board-maker))
==
::
++ board-maker
|= [b=@tas [r=resource adm=(set @p) ban=(set @p)]]
|= [b=@tas r=resource adm=(set @p) ban=(set @p)]
^- [@t json]
:- b
%- pairs
Expand All @@ -274,52 +273,57 @@
==
--
::
++ auto-jannie
|= lc=(list content)
^- (list content)
=; roody-poo=(list @t)
%+ turn lc
|= c=content
?. ?=(%text -.c) c
=/ cancel=(list tape)
%~ tap in ^- (set tape)
(~(run in words.banned) |=(@t (cass (trip +<))))
=+ review=(trip +.c)
=+ preview=(cass (trip +.c))
=+ rng=~(. og eny.bol)
|-
?~ cancel [%text (crip review)]
?~ maybe-start=(find i.cancel preview) $(cancel t.cancel)
=+ penis=(rads:rng (lent roody-poo))
=/ replace=@t
(snag -.penis roody-poo)
%= $
rng
+.penis
::
review
%+ into
(oust [(need maybe-start) (lent i.cancel)] `tape`review)
[(need maybe-start) replace]
::
preview
%+ into
(oust [(need maybe-start) (lent i.cancel)] `tape`preview)
[(need maybe-start) replace]
==
::
:~ 'roody-poo'
'sigourney'
'PENIS'
'candy-ass'
'VAGINA'
'peanut butter'
'bring back'
'grinman'
'triscuits'
'is a meme'
'ǫ̸̧͍̤̱̼̹̋̐̔̊̎̀n̶̙͍̻̭̩̰̞̱̘͊̀̂́ ̴̨̪͇̠͕̩̦̲̯͎͖̣͚̻̈́̊̅͑̂͛̈́͌̌͝u̵̝͛̅͗͑͒͐̈́̀͝r̶̘͍̖̹̘̟̰̱̥͔̙̜͇̠̿͜b̸̲̦̬͙͖̗̲͙̲̑̉́̄͝i̸̡̮̱͚̾͂̋̒̉̐̀́͐͠͝t̵̯͖͈͈͚̜̭̳̮̊́͂̾̑̽̆́͗͜͠ ̷̗̙̬͓̃͗̇͒̍͠n̴̻̬̜̙̩̠̞͚̹͙̻͠o̴̡̥̻̪̻͎̱̼̜̻͈̥̓͛̀͗̃̉̊͗̅̋̈́̔̐̕͝ ̵̰̥͇͚̦͔̱̻̤̮͈̗͕̩͗͆̄̃̉͂̄̒̀̈́ŏ̷̢̢̡̡̨͖̪̩̰̰̣͍̈́̇̍̾̽̽̈́n̷̫̹̙̝̥͒̇̿̐̋͆̆̕ͅḙ̸͓͙͗̿̄̉͆́̌̇͊̿̓́͘̚̕ ̷̢̣̫̫̘̞̪͈͕̗̥͂́̿͗̆̈́č̶̨̼͈̪̦͕̤̣͇͙̬͈̤̺̏͊͆͑̃ḁ̷̡̳̽̉̆n̶̦̥̱͎̉̉̈́̒̃̐̈́̽ ̸̢͓̙̣̺̠̳̭̌̀͐̊͑̇̽͆̈̓̆͗̚͜h̸͓͚̩̹̠̼̳̿̋͋͒͛e̸̡̧̨̡̧͍͎̲͕̯̯͎̞̬̻̐̌͂̽͐̌͘͝͠͝á̴̧̫̥͇͍͈̰̜̰͊̈̾̽̅̕̚͝r̴̨̛̛͈͓̜̳̺̤̘̺̼͙̀̈́̅͑̀̍̀́͘̚͝ ̴̡̢̰̼̺̐͊͑̒̕͝ͅỳ̶̩̝̭̞̣̦̰̜͓͠͝ͅò̸̢̜̦̰̥̭͖͂͌̀̋́̊̊͘̚̚͝u̴̧̦̻̜̔͐̊̐̉̈̈́͒͘ ̷̢̨̹̘͕̓͌̎͐s̵̨̫̄̑͠ͅç̶͖̦͍̹̣̦̬̳͓̙͍̞͊̈́́̌̚ŗ̶̞͈̲͚͊̌́̍̌͛̕͝e̵̖̪̼̻̦̦͔̤̦̲̖̳̜͗̋̂̓̆̇̿́͐̎͜͠͠ā̶̻͔̟͒̋̋̆͑͒͋͘̕m̴̧̟̦͈̒̋'
++ auto-jannie
|= lc=(list content)
^- (list content)
=; roody-poo=(list @t)
%+ turn lc
|= c=content
?. ?=(%text -.c)
?. ?=(%url -.c) c
?.((gte 5.001 (met 3 +.c)) !! c)
?. (gte 5.001 (met 3 +.c)) !!
=/ cancel=(list tape)
%~ tap in ^- (set tape)
(~(run in words.banned) |=(@t (cass (trip +<))))
=+ review=(trip +.c)
=+ preview=(cass (trip +.c))
=+ rng=~(. og eny.bol)
|-
?~ cancel [%text (crip review)]
?~ maybe-start=(find i.cancel preview)
$(cancel t.cancel)
=+ penis=(rads:rng (lent roody-poo))
=/ replace=@t
(snag -.penis roody-poo)
%= $
rng
+.penis
::
review
%+ into
(oust [(need maybe-start) (lent i.cancel)] `tape`review)
[(need maybe-start) replace]
::
preview
%+ into
(oust [(need maybe-start) (lent i.cancel)] `tape`preview)
[(need maybe-start) replace]
==
::
:~ 'roody-poo'
'sigourney'
'PENIS'
'candy-ass'
'VAGINA'
'peanut butter'
'bring back'
'grinman'
'triscuits'
'is a meme'
'ǫ̸̧͍̤̱̼̹̋̐̔̊̎̀n̶̙͍̻̭̩̰̞̱̘͊̀̂́ ̴̨̪͇̠͕̩̦̲̯͎͖̣͚̻̈́̊̅͑̂͛̈́͌̌͝u̵̝͛̅͗͑͒͐̈́̀͝r̶̘͍̖̹̘̟̰̱̥͔̙̜͇̠̿͜b̸̲̦̬͙͖̗̲͙̲̑̉́̄͝i̸̡̮̱͚̾͂̋̒̉̐̀́͐͠͝t̵̯͖͈͈͚̜̭̳̮̊́͂̾̑̽̆́͗͜͠ ̷̗̙̬͓̃͗̇͒̍͠n̴̻̬̜̙̩̠̞͚̹͙̻͠o̴̡̥̻̪̻͎̱̼̜̻͈̥̓͛̀͗̃̉̊͗̅̋̈́̔̐̕͝ ̵̰̥͇͚̦͔̱̻̤̮͈̗͕̩͗͆̄̃̉͂̄̒̀̈́ŏ̷̢̢̡̡̨͖̪̩̰̰̣͍̈́̇̍̾̽̽̈́n̷̫̹̙̝̥͒̇̿̐̋͆̆̕ͅḙ̸͓͙͗̿̄̉͆́̌̇͊̿̓́͘̚̕ ̷̢̣̫̫̘̞̪͈͕̗̥͂́̿͗̆̈́č̶̨̼͈̪̦͕̤̣͇͙̬͈̤̺̏͊͆͑̃ḁ̷̡̳̽̉̆n̶̦̥̱͎̉̉̈́̒̃̐̈́̽ ̸̢͓̙̣̺̠̳̭̌̀͐̊͑̇̽͆̈̓̆͗̚͜h̸͓͚̩̹̠̼̳̿̋͋͒͛e̸̡̧̨̡̧͍͎̲͕̯̯͎̞̬̻̐̌͂̽͐̌͘͝͠͝á̴̧̫̥͇͍͈̰̜̰͊̈̾̽̅̕̚͝r̴̨̛̛͈͓̜̳̺̤̘̺̼͙̀̈́̅͑̀̍̀́͘̚͝ ̴̡̢̰̼̺̐͊͑̒̕͝ͅỳ̶̩̝̭̞̣̦̰̜͓͠͝ͅò̸̢̜̦̰̥̭͖͂͌̀̋́̊̊͘̚̚͝u̴̧̦̻̜̔͐̊̐̉̈̈́͒͘ ̷̢̨̹̘͕̓͌̎͐s̵̨̫̄̑͠ͅç̶͖̦͍̹̣̦̬̳͓̙͍̞͊̈́́̌̚ŗ̶̞͈̲͚͊̌́̍̌͛̕͝e̵̖̪̼̻̦̦͔̤̦̲̖̳̜͗̋̂̓̆̇̿́͐̎͜͠͠ā̶̻͔̟͒̋̋̆͑͒͋͘̕m̴̧̟̦͈̒̋'
'none of your features will be included'
==
::
++ ru
|%
Expand Down
12 changes: 11 additions & 1 deletion ui/src/components/postbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export default function PostBox({ index, ship, board, className = "" }) {
}, [file]);

const submitReply = () => {
let message = "nice try hackerman ;)\n"
if ((new TextEncoder().encode(image)).length > 1000) {
return window.alert(message + "image field length can't be more than 1k characters");
} else if ((new TextEncoder().encode(reply)).length > 5000) {
return window.alert(message + "text field length can't be more than 5k characters")
}

return window.api
.poke({
app: "channel-client",
Expand Down Expand Up @@ -63,6 +70,7 @@ export default function PostBox({ index, ship, board, className = "" }) {
placeholder="https://urbit.org/loss.jpg"
className="outline outline-1 p-3 bg-chan-element"
onChange={(e) => setImage(e.target.value)}
maxLength={1000}
/>
{client !== null && (
<input onChange={(e) => setFile(e.target.files)} type="file" />
Expand All @@ -71,10 +79,12 @@ export default function PostBox({ index, ship, board, className = "" }) {
<textarea
className="outline outline-1 p-3 w-full bg-chan-element max-h-56 h-24"
onChange={(e) => setReply(e.target.value)}
maxLength={5000}
/>
<button
className="outline outline-1 outline-gray-300 p-2 bg-chan-element text-chan-red max-w-fit"
onClick={submitReply}
onClick={
submitReply}
>
post
</button>
Expand Down