mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
Merge branch 'v0.8.0.rc' into jael-recursion-fix
This commit is contained in:
commit
e7455147ec
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ff940a247fd3165fe55bd51f67762e857d63bb06220672599cc9e76ccf9f9e8e
|
||||
size 5846934
|
||||
oid sha256:f643e9f47f00558c8b900bc3d37ed9e5b2c38afae31e80cb106fb32042d8bcbb
|
||||
size 5976443
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1a95baff9ddb8fd17aaabff7e6f392e429f581cf107c0fa38faeb9c3feb6108a
|
||||
size 8556266
|
||||
oid sha256:3f9fded01729cc0693ab3d060427fc4d6d22ef100b3c29c3e6d6cfe4d7f7704f
|
||||
size 8632183
|
||||
|
@ -12,6 +12,7 @@ crossenv.make_derivation rec {
|
||||
"--disable-shared"
|
||||
"--disable-manual"
|
||||
"--disable-ldap"
|
||||
"--with-ssl=${openssl}"
|
||||
];
|
||||
|
||||
src = crossenv.nixpkgs.fetchurl {
|
||||
|
@ -11,5 +11,5 @@ make all -j8
|
||||
make test
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp urbit $out/bin/$exename
|
||||
cp urbit-worker $out/bin/$exename-worker
|
||||
cp ./build/urbit $out/bin/$exename
|
||||
cp ./build/urbit-worker $out/bin/$exename-worker
|
||||
|
@ -11,7 +11,7 @@ let
|
||||
|
||||
deps =
|
||||
with pkgs;
|
||||
[ curl gmp libsigsegv ncurses openssl zlib lmdb ];
|
||||
[ curl gmp libsigsegv ncurses openssl zlib lmdb cacert xxd ];
|
||||
|
||||
vendor =
|
||||
[ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ];
|
||||
|
@ -1,6 +1,6 @@
|
||||
{ env_name, env, deps }:
|
||||
|
||||
{ ent, ge-additions, name ? "urbit", debug ? false }:
|
||||
{ ent, ge-additions, cacert, xxd, name ? "urbit", debug ? false }:
|
||||
|
||||
let
|
||||
|
||||
@ -21,10 +21,12 @@ env.make_derivation {
|
||||
CPU_DEBUG = debug;
|
||||
EVENT_TIME_DEBUG = false;
|
||||
NCURSES = env.ncurses;
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
name = "${name}-${env_name}";
|
||||
exename = name;
|
||||
src = ../../../pkg/urbit;
|
||||
cross_inputs = crossdeps ++ vendor ++ [ ent ];
|
||||
builder = ./release.sh;
|
||||
name = "${name}-${env_name}";
|
||||
exename = name;
|
||||
src = ../../../pkg/urbit;
|
||||
native_inputs = [ xxd ];
|
||||
cross_inputs = crossdeps ++ vendor ++ [ ent ];
|
||||
builder = ./release.sh;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ PKG_CONFIG=pkg-config-cross \
|
||||
HOST=$host \
|
||||
bash ./configure
|
||||
|
||||
make urbit urbit-worker -j8
|
||||
make build/urbit build/urbit-worker -j8
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp -r $NCURSES/share/terminfo $out/bin/$exename-terminfo
|
||||
cp urbit $out/bin/$exename
|
||||
cp urbit-worker $out/bin/$exename-worker
|
||||
cp ./build/urbit $out/bin/$exename
|
||||
cp ./build/urbit-worker $out/bin/$exename-worker
|
||||
|
@ -21,7 +21,8 @@ let
|
||||
|
||||
urbit = env:
|
||||
import ./pkgs/urbit/release.nix env
|
||||
{ ent = ent env; ge-additions = ge-additions env; debug = false; name = "urbit"; };
|
||||
{ ent = ent env; ge-additions = ge-additions env; cacert = nixpkgs.cacert;
|
||||
xxd = nixpkgs.xxd; debug = false; name = "urbit"; };
|
||||
|
||||
builds-for-platform = plat:
|
||||
plat.deps // {
|
||||
|
@ -1,37 +1,37 @@
|
||||
::
|
||||
:: /app/write.hoon
|
||||
:: /app/publish.hoon
|
||||
::
|
||||
/- hall, *write
|
||||
/+ *server, *write
|
||||
/- hall, *publish
|
||||
/+ *server, *publish
|
||||
::
|
||||
/= index
|
||||
/^ $-(json manx)
|
||||
/: /===/app/write/index /!noun/
|
||||
/: /===/app/publish/index /!noun/
|
||||
::
|
||||
/= js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/| /: /===/app/write/js/index /js/
|
||||
/| /: /===/app/publish/js/index /js/
|
||||
/~ ~
|
||||
==
|
||||
::
|
||||
/= css
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/| /: /===/app/write/css/index /css/
|
||||
/| /: /===/app/publish/css/index /css/
|
||||
/~ ~
|
||||
==
|
||||
::
|
||||
/= tile-js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/| /: /===/app/write/js/tile /js/
|
||||
/| /: /===/app/publish/js/tile /js/
|
||||
/~ ~
|
||||
==
|
||||
::
|
||||
/= images
|
||||
/^ (map knot @)
|
||||
/: /===/app/write/img /_ /png/
|
||||
/: /===/app/publish/img /_ /png/
|
||||
::
|
||||
|%
|
||||
::
|
||||
@ -54,26 +54,46 @@
|
||||
::
|
||||
+$ poke
|
||||
$% [%hall-action action:hall]
|
||||
[%write-action action]
|
||||
[%publish-action action]
|
||||
[%launch-action @tas path @t]
|
||||
==
|
||||
::
|
||||
+$ diff
|
||||
$% [%hall-rumor rumor:hall]
|
||||
[%json json]
|
||||
[%write-collection collection]
|
||||
[%write-rumor rumor]
|
||||
[%write-update update]
|
||||
[%publish-collection collection]
|
||||
[%publish-rumor rumor]
|
||||
[%publish-update update]
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
||||
|_ [bol=bowl:gall sat=state]
|
||||
|_ [bol=bowl:gall %0 sat=state]
|
||||
::
|
||||
++ this .
|
||||
:: +our-beak: beak for this app, with case set to current invocation date
|
||||
::
|
||||
++ our-beak /(scot %p our.bol)/[q.byk.bol]/(scot %da now.bol)
|
||||
:: +prep: set up eyre connection and modulo tile; adapt state
|
||||
::
|
||||
++ prep
|
||||
=> |%
|
||||
++ states
|
||||
$% [%0 s=state]
|
||||
==
|
||||
--
|
||||
|= old=(unit states)
|
||||
^- (quip move _this)
|
||||
?~ old
|
||||
:_ this
|
||||
:~ [ost.bol %connect / [~ /'~publish'] %publish]
|
||||
:* ost.bol %poke /publish [our.bol %launch]
|
||||
%launch-action %publish /publishtile '/~publish/tile.js'
|
||||
==
|
||||
==
|
||||
?- -.u.old
|
||||
%0 [~ this(sat s.u.old)]
|
||||
==
|
||||
::
|
||||
++ ships-to-whom
|
||||
|= ships=(set @p)
|
||||
@ -86,7 +106,7 @@
|
||||
++ get-contributors
|
||||
|= coll=@tas
|
||||
^- [mod=?(%white %black) who=(set @p)]
|
||||
=/ pax (weld our-beak /web/write/[coll])
|
||||
=/ pax (weld our-beak /web/publish/[coll])
|
||||
=/ pem=[r=dict:clay w=dict:clay] .^([dict:clay dict:clay] %cp pax)
|
||||
:- mod.rul.w.pem
|
||||
(resolve-real rul.w.pem)
|
||||
@ -180,21 +200,6 @@
|
||||
[' ==' ~]
|
||||
==
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit *)
|
||||
^- (quip move _this)
|
||||
~& write-prep+act.bol
|
||||
?~ old
|
||||
:_ this(sat *state)
|
||||
:~ [ost.bol %connect / [~ /'~publish'] %write]
|
||||
:* ost.bol %poke /publish [our.bol %launch]
|
||||
%launch-action %write /publishtile '/~publish/tile.js'
|
||||
==
|
||||
==
|
||||
::
|
||||
:: [~ this(sat *state)]
|
||||
[~ this(sat (state u.old))]
|
||||
::
|
||||
++ poke-noun
|
||||
|= a=*
|
||||
^- (quip move _this)
|
||||
@ -202,23 +207,10 @@
|
||||
[~ this]
|
||||
?+ a
|
||||
[~ this]
|
||||
::
|
||||
%test
|
||||
=/ whoms (ships-to-whom (sy ~zod ~bus ~marzod ~binzod ~))
|
||||
=/ ships (whom-to-ships whoms)
|
||||
~& whoms
|
||||
~& ships
|
||||
[~ this]
|
||||
::
|
||||
%print-bowl
|
||||
~& bol
|
||||
[~ this]
|
||||
::
|
||||
%update-tile
|
||||
[make-tile-moves this]
|
||||
::
|
||||
%flush-state
|
||||
[~ this(sat *state)]
|
||||
::
|
||||
%print-state
|
||||
~& sat
|
||||
@ -345,7 +337,7 @@
|
||||
::
|
||||
=/ old=(unit collection) (~(get by pubs.sat) col.del)
|
||||
?~ old
|
||||
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
|
||||
[~ da-this]
|
||||
=. pubs.sat (~(del by pubs.sat) col.del)
|
||||
:- ~(tap in ~(key by pos.u.old))
|
||||
(da-emil (affection del))
|
||||
@ -353,10 +345,10 @@
|
||||
::
|
||||
=/ old=(unit collection) (~(get by subs.sat) who.del col.del)
|
||||
?~ old
|
||||
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
|
||||
[~ da-this]
|
||||
=. subs.sat (~(del by subs.sat) who.del col.del)
|
||||
:- ~(tap in ~(key by pos.u.old))
|
||||
(da-emit [ost.bol %pull /collection/[col.del] [who.del %write] ~])
|
||||
(da-emit [ost.bol %pull /collection/[col.del] [who.del %publish] ~])
|
||||
:: iterate through post ids collected before, removing each from
|
||||
:: secondary indices in state
|
||||
::
|
||||
@ -376,9 +368,9 @@
|
||||
(~(get by pubs.sat) col.del)
|
||||
(~(get by subs.sat) who.del col.del)
|
||||
?~ old
|
||||
~|([%cant-delete-nonexistent-blog who.del col.del] !!)
|
||||
da-this
|
||||
?. (~(has in ~(key by pos.u.old)) u.pos.del)
|
||||
~|([%cant-delete-nonexistent-post who.del col.del pos.del] !!)
|
||||
da-this
|
||||
=/ new=collection
|
||||
%= u.old
|
||||
pos (~(del by pos.u.old) u.pos.del)
|
||||
@ -421,25 +413,29 @@
|
||||
?~ col
|
||||
da-this
|
||||
=/ new=collection u.col
|
||||
=/ pin-ids=(list @) (fand [post]~ pin.order.u.col)
|
||||
=. pin.order.u.col
|
||||
=/ pin-ids=(list @) (fand [post]~ pin.order.new)
|
||||
=. pin.order.new
|
||||
|-
|
||||
?~ pin-ids
|
||||
pin.order.u.col
|
||||
pin.order.new
|
||||
%= $
|
||||
pin.order.u.col (oust [i.pin-ids 1] pin.order.u.col)
|
||||
pin.order.new (oust [i.pin-ids 1] pin.order.new)
|
||||
pin-ids t.pin-ids
|
||||
==
|
||||
::
|
||||
=/ unpin-ids=(list @) (fand [post]~ unpin.order.u.col)
|
||||
=. unpin.order.u.col
|
||||
=/ unpin-ids=(list @) (fand [post]~ unpin.order.new)
|
||||
=. unpin.order.new
|
||||
|-
|
||||
?~ unpin-ids
|
||||
unpin.order.u.col
|
||||
unpin.order.new
|
||||
%= $
|
||||
unpin.order.u.col (oust [i.unpin-ids 1] unpin.order.u.col)
|
||||
unpin.order.new (oust [i.unpin-ids 1] unpin.order.new)
|
||||
unpin-ids t.unpin-ids
|
||||
==
|
||||
=? pubs.sat =(who our.bol)
|
||||
(~(put by pubs.sat) coll new)
|
||||
=? subs.sat !=(who our.bol)
|
||||
(~(put by subs.sat) [who coll] new)
|
||||
(da-emil make-tile-moves)
|
||||
::
|
||||
++ da-remove
|
||||
@ -462,14 +458,14 @@
|
||||
++ da-insert-latest
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
^+ da-this
|
||||
=/ new-date=@da date-created:(need (get-post-by-index who coll post))
|
||||
=/ new-date=@da date-created:(need (get-post-info-by-index who coll post))
|
||||
=/ pre=(list [@p @tas @tas]) ~
|
||||
=/ suf=(list [@p @tas @tas]) latest.sat
|
||||
=? latest.sat =(~ (find [who coll post]~ latest.sat))
|
||||
|-
|
||||
?~ suf
|
||||
(weld pre [who coll post]~)
|
||||
=/ i-date=@da date-created:(need (get-post-by-index i.suf))
|
||||
=/ i-date=@da date-created:(need (get-post-info-by-index i.suf))
|
||||
?: (gte new-date i-date)
|
||||
(weld pre [[who coll post] suf])
|
||||
%= $
|
||||
@ -481,7 +477,7 @@
|
||||
++ da-insert-order
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
^+ da-this
|
||||
=/ new-post=post-info (need (get-post-by-index who coll post))
|
||||
=/ new-post=post-info (need (get-post-info-by-index who coll post))
|
||||
=/ col=collection (need (get-coll-by-index who coll))
|
||||
::
|
||||
=/ pre=(list @tas) ~
|
||||
@ -498,7 +494,7 @@
|
||||
(snoc pre post)
|
||||
?: =(post i.suf)
|
||||
(weld pre suf)
|
||||
=/ i-date=@da date-created:(need (get-post-by-index who coll i.suf))
|
||||
=/ i-date=@da date-created:(need (get-post-info-by-index who coll i.suf))
|
||||
?: (gte date-created.new-post i-date)
|
||||
(weld pre [post suf])
|
||||
%= $
|
||||
@ -543,7 +539,7 @@
|
||||
=/ rum=(unit rumor) (feel p del)
|
||||
?~ rum
|
||||
~
|
||||
[b %diff %write-rumor u.rum]~
|
||||
[b %diff %publish-rumor u.rum]~
|
||||
:: +feel: delta to rumor
|
||||
::
|
||||
++ feel
|
||||
@ -563,6 +559,19 @@
|
||||
==
|
||||
::
|
||||
++ get-post-by-index
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
^- (unit (each [post-info manx @t] tang))
|
||||
=/ col=(unit collection)
|
||||
?: =(our.bol who)
|
||||
(~(get by pubs.sat) coll)
|
||||
(~(get by subs.sat) who coll)
|
||||
?~ col ~
|
||||
=/ pos=(unit [bone (each [post-info manx @t] tang)])
|
||||
(~(get by pos.u.col) post)
|
||||
?~ pos ~
|
||||
[~ +.u.pos]
|
||||
::
|
||||
++ get-post-info-by-index
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
^- (unit post-info)
|
||||
=/ col=(unit collection)
|
||||
@ -599,7 +608,7 @@
|
||||
?: ?=([%error *] build-result.mad)
|
||||
[%.n message.build-result.mad]
|
||||
?> ?=(%bake +<.build-result.mad)
|
||||
?> ?=(%write-info p.cage.build-result.mad)
|
||||
?> ?=(%publish-info p.cage.build-result.mad)
|
||||
[%.y (collection-info q.q.cage.build-result.mad)]
|
||||
::
|
||||
?~ awa
|
||||
@ -667,7 +676,7 @@
|
||||
?: ?=([%error *] build-result.mad)
|
||||
[%.n message.build-result.mad]
|
||||
?> ?=(%bake +<.build-result.mad)
|
||||
?> ?=(%write-post p.cage.build-result.mad)
|
||||
?> ?=(%publish-post p.cage.build-result.mad)
|
||||
[%.y (,[post-info manx @t] q.q.cage.build-result.mad)]
|
||||
::
|
||||
?~ awa
|
||||
@ -735,7 +744,7 @@
|
||||
?: ?=([%error *] build-result.mad)
|
||||
[%.n message.build-result.mad]
|
||||
?> ?=(%bake +<.build-result.mad)
|
||||
?> ?=(%write-comments p.cage.build-result.mad)
|
||||
?> ?=(%publish-comments p.cage.build-result.mad)
|
||||
[%.y (,(list [comment-info @t]) q.q.cage.build-result.mad)]
|
||||
::
|
||||
?~ awa
|
||||
@ -820,8 +829,8 @@
|
||||
^- (list move)
|
||||
=/ files=(list path)
|
||||
?~ post
|
||||
.^((list path) %ct (weld our-beak /web/write/[coll]))
|
||||
.^((list path) %ct (weld our-beak /web/write/[coll]/[u.post]))
|
||||
.^((list path) %ct (weld our-beak /web/publish/[coll]))
|
||||
.^((list path) %ct (weld our-beak /web/publish/[coll]/[u.post]))
|
||||
%+ turn files
|
||||
|= pax=path
|
||||
^- move
|
||||
@ -835,7 +844,7 @@
|
||||
%- (slog u.err)
|
||||
[~ this]
|
||||
::
|
||||
++ poke-write-action
|
||||
++ poke-publish-action
|
||||
|= act=action
|
||||
^- (quip move _this)
|
||||
?- -.act
|
||||
@ -857,27 +866,27 @@
|
||||
now.bol
|
||||
now.bol
|
||||
==
|
||||
=/ pax=path /web/write/[name.act]/write-info
|
||||
=/ pax=path /web/publish/[name.act]/publish-info
|
||||
=/ blog-perms=card
|
||||
:* %perm /perms q.byk.bol
|
||||
/web/write/[name.act]
|
||||
/web/publish/[name.act]
|
||||
%rw `read.perm.act `write.perm.act
|
||||
==
|
||||
=/ info-perms=card
|
||||
:* %perm /perms q.byk.bol
|
||||
/web/write/[name.act]/write-info
|
||||
/web/publish/[name.act]/publish-info
|
||||
%rw `*rule:clay `*rule:clay
|
||||
==
|
||||
::
|
||||
=/ wir=wire /collection/[name.act]
|
||||
=/ schema=schematic:ford
|
||||
:* %bake
|
||||
%write-info
|
||||
%publish-info
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[name.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[name.act]/publish/web]
|
||||
==
|
||||
:_ this
|
||||
:~ (write-file pax %write-info !>(conf))
|
||||
:~ (write-file pax %publish-info !>(conf))
|
||||
[ost.bol blog-perms]
|
||||
[ost.bol info-perms]
|
||||
[ost.bol %build wir %.y schema]
|
||||
@ -886,8 +895,8 @@
|
||||
%new-post
|
||||
?. =(who.act our.bol)
|
||||
:_ this
|
||||
[ost.bol %poke /forward [who.act %write] %write-action act]~
|
||||
=/ pax=path /web/write/[coll.act]/[name.act]/udon
|
||||
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
|
||||
=/ pax=path /web/publish/[coll.act]/[name.act]/udon
|
||||
?. (allowed src.bol %write pax)
|
||||
[~ this]
|
||||
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
|
||||
@ -912,27 +921,27 @@
|
||||
=/ post-wir=wire /post/[coll.act]/[name.act]
|
||||
=/ post-schema=schematic:ford
|
||||
:* %bake
|
||||
%write-post
|
||||
%publish-post
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[name.act]/[coll.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[name.act]/[coll.act]/publish/web]
|
||||
==
|
||||
::
|
||||
=/ comments-wir=wire /comments/[coll.act]/[name.act]
|
||||
=/ comments-schema=schematic:ford
|
||||
:* %bake
|
||||
%write-comments
|
||||
%publish-comments
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[name.act]/[coll.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[name.act]/[coll.act]/publish/web]
|
||||
==
|
||||
::
|
||||
=/ post-perms=card
|
||||
:* %perm /perms q.byk.bol
|
||||
/web/write/[coll.act]/[name.act]/udon
|
||||
/web/publish/[coll.act]/[name.act]/udon
|
||||
%w `[%white (ships-to-whom (sy src.bol ~))]
|
||||
==
|
||||
=/ comment-perms=card
|
||||
:* %perm /perms q.byk.bol
|
||||
/web/write/[coll.act]/[name.act]
|
||||
/web/publish/[coll.act]/[name.act]
|
||||
%w `[%black ~]
|
||||
==
|
||||
:_ this
|
||||
@ -946,8 +955,9 @@
|
||||
%new-comment
|
||||
?. =(who.act our.bol)
|
||||
:_ this
|
||||
[ost.bol %poke /forward [who.act %write] %write-action act]~
|
||||
=/ pax=path /web/write/[coll.act]/[post.act]/(scot %da now.bol)/udon
|
||||
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
|
||||
=/ pax=path
|
||||
/web/publish/[coll.act]/[post.act]/(scot %da now.bol)/publish-comment
|
||||
?. (allowed src.bol %write pax)
|
||||
[~ this]
|
||||
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
|
||||
@ -955,17 +965,9 @@
|
||||
[~ this]
|
||||
?. (~(has by pos.u.col) post.act)
|
||||
[~ this]
|
||||
::
|
||||
=. content.act (cat 3 content.act '\0a') :: XX fix udon parser
|
||||
=/ front=(map knot cord)
|
||||
%- my
|
||||
:~ [%creator (scot %p src.bol)]
|
||||
[%collection coll.act]
|
||||
[%post post.act]
|
||||
[%date-created (scot %da now.bol)]
|
||||
[%last-modified (scot %da now.bol)]
|
||||
==
|
||||
=/ out=@t (update-udon-front front content.act)
|
||||
|
||||
=/ com=comment
|
||||
[[src.bol coll.act post.act now.bol now.bol] content.act]
|
||||
::
|
||||
=/ comment-perms=card
|
||||
:* %perm /perms q.byk.bol pax
|
||||
@ -973,7 +975,7 @@
|
||||
==
|
||||
::
|
||||
:_ this
|
||||
:~ (write-file pax %udon !>(out))
|
||||
:~ (write-file pax %publish-comment !>(com))
|
||||
[ost.bol comment-perms]
|
||||
==
|
||||
::
|
||||
@ -1016,7 +1018,7 @@
|
||||
?. =(src.bol our.bol)
|
||||
[~ this]
|
||||
:_ this
|
||||
[(delete-file /web/write/[coll.act]/[post.act]/[comment.act]/udon)]~
|
||||
[(delete-file /web/publish/[coll.act]/[post.act]/[comment.act]/udon)]~
|
||||
::
|
||||
%edit-collection
|
||||
?. =(src.bol our.bol)
|
||||
@ -1026,9 +1028,9 @@
|
||||
%edit-post
|
||||
?. =(who.act our.bol)
|
||||
:_ this
|
||||
[ost.bol %poke /forward [who.act %write] %write-action act]~
|
||||
[ost.bol %poke /forward [who.act %publish] %publish-action act]~
|
||||
::
|
||||
=/ pax=path /web/write/[coll.act]/[name.act]/udon
|
||||
=/ pax=path /web/publish/[coll.act]/[name.act]/udon
|
||||
?. (allowed src.bol %write pax)
|
||||
[~ this]
|
||||
=/ col=(unit collection) (~(get by pubs.sat) coll.act)
|
||||
@ -1037,9 +1039,14 @@
|
||||
?. (~(has by pos.u.col) name.act)
|
||||
[~ this]
|
||||
::
|
||||
=/ pos=(unit post-info) (get-post-by-index who.act coll.act name.act)
|
||||
=/ pos=(unit (each [post-info manx @t] tang))
|
||||
(get-post-by-index who.act coll.act name.act)
|
||||
?~ pos
|
||||
~| %editing-non-existent-post !!
|
||||
=/ date-created=@da
|
||||
?: ?=(%.y -.u.pos)
|
||||
date-created.-.p.u.pos
|
||||
now.bol
|
||||
::
|
||||
=. content.act (cat 3 content.act '\0a') :: XX fix udon parser
|
||||
=/ front=(map knot cord)
|
||||
@ -1049,9 +1056,9 @@
|
||||
[%collection coll.act]
|
||||
[%filename name.act]
|
||||
[%comments com.act]
|
||||
[%date-created (scot %da date-created.u.pos)]
|
||||
[%date-created (scot %da date-created)]
|
||||
[%last-modified (scot %da now.bol)]
|
||||
[%pinned ?:(pinned.u.pos %true %false)]
|
||||
[%pinned %false]
|
||||
==
|
||||
=/ out=@t (update-udon-front front content.act)
|
||||
::
|
||||
@ -1068,14 +1075,14 @@
|
||||
%+ turn who.act
|
||||
|= who=@p
|
||||
^- move
|
||||
[ost.bol %poke /forward [who %write] %write-action new-act]
|
||||
[ost.bol %poke /forward [who %publish] %publish-action new-act]
|
||||
=. invites.sat (~(put by invites.sat) [src.bol coll.act] title.act)
|
||||
:_ this
|
||||
%+ welp make-tile-moves
|
||||
::
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [b=bone *]
|
||||
[b %diff %write-update %invite %.y src.bol coll.act title.act]
|
||||
[b %diff %publish-update %invite %.y src.bol coll.act title.act]
|
||||
::
|
||||
:: %reject-invite: remove invite from list, acceptance is handled by
|
||||
:: %subscribe action
|
||||
@ -1091,7 +1098,7 @@
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [b=bone *]
|
||||
^- move
|
||||
[b %diff %write-update %invite %.n who.act coll.act u.title]
|
||||
[b %diff %publish-update %invite %.n who.act coll.act u.title]
|
||||
::
|
||||
:: %serve:
|
||||
::
|
||||
@ -1100,44 +1107,44 @@
|
||||
?: (~(has by pubs.sat) coll.act)
|
||||
[~ this]
|
||||
=/ files=(list path)
|
||||
.^((list path) %ct (weld our-beak /web/write/[coll.act]))
|
||||
.^((list path) %ct (weld our-beak /web/publish/[coll.act]))
|
||||
=/ all=[moves=(list move) builds=(set wire)]
|
||||
%+ roll files
|
||||
|= [pax=path out=[moves=(list move) builds=(set wire)]]
|
||||
?+ pax
|
||||
out
|
||||
::
|
||||
[%web %write @tas %write-info ~]
|
||||
[%web %publish @tas %publish-info ~]
|
||||
?> =(coll.act i.t.t.pax)
|
||||
=/ wir=wire /collection/[coll.act]
|
||||
=/ schema=schematic:ford
|
||||
:* %bake
|
||||
%write-info
|
||||
%publish-info
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[coll.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[coll.act]/publish/web]
|
||||
==
|
||||
%= out
|
||||
moves [[ost.bol %build wir %.y schema] moves.out]
|
||||
builds (~(put in builds.out) wir)
|
||||
==
|
||||
::
|
||||
[%web %write @tas @tas %udon ~]
|
||||
[%web %publish @tas @tas %udon ~]
|
||||
?> =(coll.act i.t.t.pax)
|
||||
=/ post i.t.t.t.pax
|
||||
=/ post-wir=wire /post/[coll.act]/[post]
|
||||
=/ post-schema=schematic:ford
|
||||
:* %bake
|
||||
%write-post
|
||||
%publish-post
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[post]/[coll.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[post]/[coll.act]/publish/web]
|
||||
==
|
||||
::
|
||||
=/ comments-wir=wire /comments/[coll.act]/[post]
|
||||
=/ comments-schema=schematic:ford
|
||||
:* %bake
|
||||
%write-comments
|
||||
%publish-comments
|
||||
*coin
|
||||
[[our.bol q.byk.bol] /[post]/[coll.act]/write/web]
|
||||
[[our.bol q.byk.bol] /[post]/[coll.act]/publish/web]
|
||||
==
|
||||
%= out
|
||||
moves
|
||||
@ -1186,12 +1193,12 @@
|
||||
:_ this(outgoing.sat (~(put by outgoing.sat) wir ost.bol))
|
||||
;: welp
|
||||
make-tile-moves
|
||||
[ost.bol %peer wir [who.act %write] wir]~
|
||||
[ost.bol %peer wir [who.act %publish] wir]~
|
||||
?~ title ~
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [b=bone *]
|
||||
^- move
|
||||
[b %diff %write-update %invite %.n who.act coll.act u.title]
|
||||
[b %diff %publish-update %invite %.n who.act coll.act u.title]
|
||||
==
|
||||
::
|
||||
:: %unsubscribe: unsub from a foreign blog, delete all state related to it
|
||||
@ -1221,12 +1228,12 @@
|
||||
latest.sat new-latest
|
||||
outgoing.sat (~(del by outgoing.sat) wir)
|
||||
==
|
||||
:- [u.bon %pull wir [who.act %write] ~]
|
||||
:- [u.bon %pull wir [who.act %publish] ~]
|
||||
%+ welp make-tile-moves
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [b=bone *]
|
||||
^- move
|
||||
[b %diff %write-rumor %remove who.act coll.act ~]
|
||||
[b %diff %publish-rumor %remove who.act coll.act ~]
|
||||
::
|
||||
:: %read: notify that we've seen a post
|
||||
::
|
||||
@ -1301,27 +1308,15 @@
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
:: new
|
||||
::
|
||||
[[~ [%'~publish' @t @t %new ~]] ~]
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
:: new
|
||||
::
|
||||
[[~ [%'~publish' %new ~]] ~]
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
:: new post
|
||||
::
|
||||
[[~ [%'~publish' %new %post ~]] ~]
|
||||
[[~ [%'~publish' %new-post ~]] ~]
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
:: new blog
|
||||
::
|
||||
[[~ [%'~publish' %new %blog ~]] ~]
|
||||
[[~ [%'~publish' %new-blog ~]] ~]
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
@ -1340,14 +1335,6 @@
|
||||
=/ blog=@tas i.t.t.site.request-line
|
||||
=/ post=@tas i.t.t.t.site.request-line
|
||||
::
|
||||
:: ?~ who [[ost.bol %http-response not-found:app]~ this]
|
||||
:: =/ col=(unit collection)
|
||||
:: ?: =(u.who our.bol)
|
||||
:: (~(get by pubs.sat) blog)
|
||||
:: (~(get by subs.sat) u.who blog)
|
||||
:: ?~ col [[ost.bol %http-response not-found:app]~ this]
|
||||
:: =/ pos (~(get by pos.u.col) post)
|
||||
:: ?~ pos [[ost.bol %http-response not-found:app]~ this]
|
||||
=/ hym=manx (index (state-to-json sat))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
@ -1407,7 +1394,7 @@
|
||||
?. ?=([@tas ~] wir)
|
||||
[~ this]
|
||||
=/ coll=@tas i.wir
|
||||
=/ pax /web/write/[coll]
|
||||
=/ pax /web/publish/[coll]
|
||||
?. (allowed src.bol %read pax)
|
||||
:_ this
|
||||
[ost.bol %quit ~]~
|
||||
@ -1421,13 +1408,12 @@
|
||||
=/ rum=rumor
|
||||
[%total our.bol coll new]
|
||||
:_ this(pubs.sat (~(put by pubs.sat) coll new))
|
||||
[ost.bol %diff %write-rumor rum]~
|
||||
[ost.bol %diff %publish-rumor rum]~
|
||||
::
|
||||
++ diff-write-rumor
|
||||
++ diff-publish-rumor
|
||||
|= [wir=wire rum=rumor]
|
||||
^- (quip move _this)
|
||||
(bake rum)
|
||||
::
|
||||
:: +poke-handle-http-cancel: received when a connection was killed
|
||||
::
|
||||
++ poke-handle-http-cancel
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -3,7 +3,7 @@
|
||||
;html
|
||||
::
|
||||
;head
|
||||
;title: Write
|
||||
;title: Publish
|
||||
;meta(charset "utf-8");
|
||||
;meta
|
||||
=name "viewport"
|
1
pkg/arvo/app/publish/js/index.js
Normal file
1
pkg/arvo/app/publish/js/index.js
Normal file
File diff suppressed because one or more lines are too long
1
pkg/arvo/app/publish/js/tile.js
Normal file
1
pkg/arvo/app/publish/js/tile.js
Normal file
File diff suppressed because one or more lines are too long
@ -94,7 +94,7 @@
|
||||
[%home %modulo]
|
||||
[%home %launch]
|
||||
[%home %chat]
|
||||
[%home %write]
|
||||
[%home %publish]
|
||||
[%home %timer]
|
||||
[%home %clock]
|
||||
[%home %weather]
|
||||
|
@ -1,4 +1,4 @@
|
||||
/- *write
|
||||
/- *publish
|
||||
/+ elem-to-react-json
|
||||
|%
|
||||
::
|
@ -1,11 +1,11 @@
|
||||
::
|
||||
:::: /hoon/action/write/mar
|
||||
:::: /hoon/action/publish/mar
|
||||
::
|
||||
/? 309
|
||||
/- write
|
||||
/- publish
|
||||
=, format
|
||||
::
|
||||
|_ act=action:write
|
||||
|_ act=action:publish
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
@ -14,10 +14,10 @@
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:write
|
||||
++ noun action:publish
|
||||
++ json
|
||||
|= jon=^json
|
||||
%- action:write
|
||||
%- action:publish
|
||||
=< (action jon)
|
||||
|%
|
||||
++ action
|
68
pkg/arvo/mar/publish/comment.hoon
Normal file
68
pkg/arvo/mar/publish/comment.hoon
Normal file
@ -0,0 +1,68 @@
|
||||
/- publish
|
||||
!:
|
||||
|_ com=comment:publish
|
||||
::
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
:- /text/x-publish-comments
|
||||
(as-octs:mimes:html (of-wain:format txt))
|
||||
++ txt
|
||||
^- wain
|
||||
:* (cat 3 'creator: ' (scot %p creator.info.com))
|
||||
(cat 3 'collection: ' collection.info.com)
|
||||
(cat 3 'post: ' post.info.com)
|
||||
(cat 3 'date-created: ' (scot %da date-created.info.com))
|
||||
(cat 3 'last-modified: ' (scot %da last-modified.info.com))
|
||||
'-----'
|
||||
(to-wain:format body.com)
|
||||
==
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ mime
|
||||
|= [mite:eyre p=octs:eyre]
|
||||
(txt (to-wain:format q.p))
|
||||
++ txt
|
||||
|= txs=(pole @t)
|
||||
^- comment:publish
|
||||
:: TODO: putting ~ instead of * breaks this but shouldn't
|
||||
::
|
||||
?> ?= $: creator=@t
|
||||
collection=@t
|
||||
post=@t
|
||||
date-created=@t
|
||||
last-modified=@t
|
||||
line=@t
|
||||
body=*
|
||||
==
|
||||
txs
|
||||
:_ (of-wain:format (wain body.txs))
|
||||
::
|
||||
:* %+ rash creator.txs
|
||||
;~(pfix (jest 'creator: ~') fed:ag)
|
||||
::
|
||||
%+ rash collection.txs
|
||||
;~(pfix (jest 'collection: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash post.txs
|
||||
;~(pfix (jest 'post: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash date-created.txs
|
||||
;~ pfix
|
||||
(jest 'date-created: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
::
|
||||
%+ rash last-modified.txs
|
||||
;~ pfix
|
||||
(jest 'last-modified: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
::
|
||||
==
|
||||
++ noun comment:publish
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,15 +1,15 @@
|
||||
::
|
||||
:::: /hoon/info/write/mar
|
||||
:::: /hoon/info/publish/mar
|
||||
::
|
||||
/- write
|
||||
/- publish
|
||||
!:
|
||||
|_ con=collection-info:write
|
||||
|_ con=collection-info:publish
|
||||
::
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
:- /text/x-write-info
|
||||
:- /text/x-publish-info
|
||||
(as-octs:mimes:html (of-wain:format txt))
|
||||
++ txt
|
||||
^- wain
|
||||
@ -29,7 +29,7 @@
|
||||
(txt (to-wain:format q.p))
|
||||
++ txt
|
||||
|= txs=(pole @t)
|
||||
^- collection-info:write
|
||||
^- collection-info:publish
|
||||
:: TODO: putting ~ instead of * breaks this but shouldn't
|
||||
::
|
||||
?> ?= $: owner=@t
|
||||
@ -55,14 +55,14 @@
|
||||
%+ rash comments.txs
|
||||
;~ pfix
|
||||
(jest 'comments: ')
|
||||
%+ cook comment-config:write
|
||||
%+ cook comment-config:publish
|
||||
;~(pose (jest %open) (jest %closed) (jest %none))
|
||||
==
|
||||
::
|
||||
%+ rash allow-edit.txs
|
||||
;~ pfix
|
||||
(jest 'allow-edit: ')
|
||||
%+ cook edit-config:write
|
||||
%+ cook edit-config:publish
|
||||
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
|
||||
==
|
||||
::
|
||||
@ -78,7 +78,7 @@
|
||||
(cook year when:so)
|
||||
==
|
||||
==
|
||||
++ noun collection-info:write
|
||||
++ noun collection-info:publish
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,5 +1,5 @@
|
||||
/- *write
|
||||
/+ *write, elem-to-react-json
|
||||
/- *publish
|
||||
/+ *publish
|
||||
|_ rum=rumor
|
||||
++ grab
|
||||
|%
|
@ -1,4 +1,4 @@
|
||||
/- *write
|
||||
/- *publish
|
||||
|_ upd=update
|
||||
++ grab
|
||||
|%
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon/paste/write/mar
|
||||
::
|
||||
/? 310
|
||||
|_ [typ=?($hoon $md $txt) txt=@t]
|
||||
++ grab
|
||||
|%
|
||||
++ noun [?($hoon $md $txt) @t]
|
||||
++ json
|
||||
(corl need =>(dejs-soft:format (ot typ+(ci (soft ?($hoon $md $txt)) so) txt+so ~)))
|
||||
--
|
||||
--
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon/paste/write/mar
|
||||
::
|
||||
/? 310
|
||||
|_ [who=@txname loc=@txloc]
|
||||
++ grab
|
||||
|%
|
||||
++ noun [@txname @txloc]
|
||||
++ json
|
||||
(corl need =>(dejs-soft:format (ot who+so loc+so ~)))
|
||||
--
|
||||
--
|
@ -1,15 +0,0 @@
|
||||
::
|
||||
:::: /hoon/tree/write/mar
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
=, mimes:html
|
||||
=, format
|
||||
|_ [sup=spur mim=mime]
|
||||
++ grab
|
||||
|%
|
||||
++ noun [spur mime]
|
||||
++ json
|
||||
=,(dejs (ot sup+(su fel:stab) mime+(cu |=(a=@t [/ (as-octs a)]) so) ~))
|
||||
--
|
||||
--
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
:::: /hoon/wipe/write/mar
|
||||
::
|
||||
/? 310
|
||||
|_ spur
|
||||
++ grab
|
||||
|%
|
||||
++ noun spur
|
||||
++ json (corl need (su:dejs-soft:format fel:stab))
|
||||
--
|
||||
--
|
14
pkg/arvo/ren/publish/comments.hoon
Normal file
14
pkg/arvo/ren/publish/comments.hoon
Normal file
@ -0,0 +1,14 @@
|
||||
/- publish
|
||||
/+ publish
|
||||
/= result
|
||||
/^ (list comment:publish)
|
||||
/;
|
||||
|= comments=(map knot comment:publish)
|
||||
^- (list [comment-info:publish @t])
|
||||
%+ sort ~(val by comments)
|
||||
|= [a=comment:publish b=comment:publish]
|
||||
^- ?
|
||||
(lte date-created.info.a date-created.info.b)
|
||||
::
|
||||
/_ /publish-comment/
|
||||
result
|
@ -1,15 +1,15 @@
|
||||
/- write
|
||||
/+ write, cram, elem-to-react-json
|
||||
/- publish
|
||||
/+ publish, cram, elem-to-react-json
|
||||
/= args /$ ,[beam *]
|
||||
/= result
|
||||
/^ [post-info:write manx @t]
|
||||
/^ [post-info:publish manx @t]
|
||||
/;
|
||||
|= $: post-front=(map knot cord)
|
||||
post-content=manx
|
||||
post-raw=wain
|
||||
~
|
||||
==
|
||||
:+ (front-to-post-info:write post-front)
|
||||
:+ (front-to-post-info:publish post-front)
|
||||
post-content
|
||||
(of-wain:format (slag 11 post-raw))
|
||||
::
|
@ -1,27 +0,0 @@
|
||||
/- write
|
||||
/+ write, cram, elem-to-react-json
|
||||
/= args /$ ,[beam *]
|
||||
/= result
|
||||
/^ (list [comment-info:write @t])
|
||||
/;
|
||||
|= $= comments
|
||||
%+ map knot
|
||||
$: comment-front=(map knot cord)
|
||||
comment-content=wain
|
||||
~
|
||||
==
|
||||
^- (list [comment-info:write @t])
|
||||
%+ sort
|
||||
%+ turn ~(tap by comments)
|
||||
|= [fil=knot front=(map knot cord) content=wain ~]
|
||||
^- [comment-info:write @t]
|
||||
:- (front-to-comment-info:write front)
|
||||
(of-wain:format (slag 8 content))
|
||||
|= [a=[com=comment-info:write @t] b=[com=comment-info:write @t]]
|
||||
(lte date-created.com.a date-created.com.b)
|
||||
::
|
||||
/_
|
||||
/. /&front&/udon/
|
||||
/&txt&/udon/
|
||||
==
|
||||
result
|
@ -84,6 +84,8 @@
|
||||
last-modified=@da
|
||||
==
|
||||
::
|
||||
+$ comment [info=comment-info body=@t]
|
||||
::
|
||||
+$ perm-config [read=rule:clay write=rule:clay]
|
||||
::
|
||||
+$ comment-config $?(%open %closed %none)
|
||||
@ -115,7 +117,7 @@
|
||||
+$ delta
|
||||
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
|
||||
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]
|
||||
[%comments who=@p col=@tas pos=@tas dat=(each (list [comment-info @t]) tang)]
|
||||
[%comments who=@p col=@tas pos=@tas dat=(each (list comment) tang)]
|
||||
[%total who=@p col=@tas dat=collection]
|
||||
[%remove who=@p col=@tas pos=(unit @tas)]
|
||||
==
|
6
pkg/urbit/.gitignore
vendored
6
pkg/urbit/.gitignore
vendored
@ -3,12 +3,12 @@
|
||||
#
|
||||
/config.mk
|
||||
include/config.h
|
||||
include/ca-bundle.h
|
||||
#
|
||||
# Build Outputs
|
||||
#
|
||||
*.o
|
||||
/urbit
|
||||
/urbit-worker
|
||||
/build/*
|
||||
/tags
|
||||
#
|
||||
# Editor Bullshit
|
||||
@ -23,5 +23,3 @@ GRTAGS
|
||||
GTAGS
|
||||
*.swo
|
||||
*.swp
|
||||
hash_tests
|
||||
hashtable_tests
|
||||
|
@ -7,7 +7,7 @@ daemon = $(wildcard daemon/*.c)
|
||||
worker = $(wildcard worker/*.c)
|
||||
|
||||
common = $(jets) $(noun) $(vere)
|
||||
headers = $(shell find include -type f)
|
||||
headers = $(shell find include -type f) include/ca-bundle.h
|
||||
|
||||
common_objs = $(shell echo $(common) | sed 's/\.c/.o/g')
|
||||
daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g')
|
||||
@ -15,13 +15,17 @@ worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g')
|
||||
|
||||
all_objs = $(common_objs) $(daemon_objs) $(worker_objs)
|
||||
all_srcs = $(common) $(daemon) $(worker)
|
||||
all_exes = ./mug_tests jam_tests ./hashtable_tests ./urbit ./urbit-worker
|
||||
all_exes = ./build/mug_tests ./build/jam_tests ./build/hashtable_tests \
|
||||
./build/urbit ./build/urbit-worker
|
||||
|
||||
|
||||
# -Werror promotes all warnings that are enabled into errors (this is on)
|
||||
# -Wall issues all types of errors. This is off (for now)
|
||||
CFLAGS := $(CFLAGS)
|
||||
|
||||
ifeq ($(SSL_CERT_FILE),)
|
||||
$(error SSL_CERT_FILE is undefined)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -29,39 +33,50 @@ CFLAGS := $(CFLAGS)
|
||||
|
||||
################################################################################
|
||||
|
||||
all: urbit urbit-worker hashtable_tests jam_tests mug_tests
|
||||
all: $(all_exes)
|
||||
|
||||
test: hashtable_tests jam_tests mug_tests
|
||||
./hashtable_tests
|
||||
./jam_tests
|
||||
./mug_tests
|
||||
test: build/hashtable_tests build/jam_tests build/mug_tests
|
||||
./build/hashtable_tests
|
||||
./build/jam_tests
|
||||
./build/mug_tests
|
||||
|
||||
clean:
|
||||
rm -f ./tags $(all_objs) $(all_exes)
|
||||
|
||||
mrproper: clean
|
||||
rm -f config.mk include/config.h
|
||||
rm -f config.mk include/config.h include/ca-bundle.h
|
||||
|
||||
################################################################################
|
||||
|
||||
hashtable_tests: $(common_objs) tests/hashtable_tests.o
|
||||
include/ca-bundle.h:
|
||||
@echo XXD -i $(SSL_CERT_FILE)
|
||||
@cat $(SSL_CERT_FILE) > include/ca-bundle.crt
|
||||
@xxd -i include/ca-bundle.crt > include/ca-bundle.h
|
||||
@rm include/ca-bundle.crt
|
||||
|
||||
build/hashtable_tests: $(common_objs) tests/hashtable_tests.o
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
jam_tests: $(common_objs) tests/jam_tests.o
|
||||
build/jam_tests: $(common_objs) tests/jam_tests.o
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
mug_tests: $(common_objs) tests/mug_tests.o
|
||||
build/mug_tests: $(common_objs) tests/mug_tests.o
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
urbit: $(common_objs) $(daemon_objs)
|
||||
build/urbit: $(common_objs) $(daemon_objs)
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
urbit-worker: $(common_objs) $(worker_objs)
|
||||
build/urbit-worker: $(common_objs) $(worker_objs)
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
%.o: %.c $(headers)
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "all.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
#include "ca-bundle.h"
|
||||
|
||||
/* Require unsigned char
|
||||
*/
|
||||
STATIC_ASSERT(( 0 == CHAR_MIN && UCHAR_MAX == CHAR_MAX ),
|
||||
@ -362,6 +364,29 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
return c3y;
|
||||
}
|
||||
|
||||
/* _setup_cert_store: writes our embedded certificate database to a temp file
|
||||
*/
|
||||
static void
|
||||
_setup_cert_store(char* tmp_cert_file_name)
|
||||
{
|
||||
errno = 0;
|
||||
int fd = mkstemp(tmp_cert_file_name);
|
||||
if (fd < 1) {
|
||||
printf("boot: failed to write local ssl temporary certificate store: %s\n",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (-1 == write(fd, include_ca_bundle_crt, include_ca_bundle_crt_len)) {
|
||||
printf("boot: failed to write local ssl temporary certificate store: %s\n",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
setenv("SSL_CERT_FILE", tmp_cert_file_name, 1);
|
||||
}
|
||||
|
||||
|
||||
/* u3_ve_usage(): print usage and exit.
|
||||
*/
|
||||
static void
|
||||
@ -677,6 +702,9 @@ main(c3_i argc,
|
||||
}
|
||||
// printf("vere: hostname is %s\n", u3_Host.ops_u.nam_c);
|
||||
|
||||
u3K.certs_c = strdup("/tmp/urbit-ca-cert-XXXXXX");
|
||||
_setup_cert_store(u3K.certs_c);
|
||||
|
||||
if ( c3y == u3_Host.ops_u.dem && c3n == u3_Host.ops_u.bat ) {
|
||||
printf("boot: running as daemon\n");
|
||||
}
|
||||
@ -752,5 +780,6 @@ main(c3_i argc,
|
||||
|
||||
u3_daemon_commence();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -699,6 +699,7 @@
|
||||
*/
|
||||
typedef struct _u3_daemon {
|
||||
c3_c* soc_c; // socket name
|
||||
c3_c* certs_c; // ssl certificate dump
|
||||
c3_w len_w; // number used
|
||||
c3_w all_w; // number allocated
|
||||
u3_pier** tab_u; // pier table
|
||||
|
@ -466,6 +466,7 @@ _daemon_get_atom(c3_c* url_c)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, u3K.certs_c);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url_c);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _daemon_curl_alloc);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&buf_u);
|
||||
@ -840,6 +841,7 @@ void
|
||||
_daemon_loop_exit()
|
||||
{
|
||||
unlink(u3K.soc_c);
|
||||
unlink(u3K.certs_c);
|
||||
}
|
||||
|
||||
/* u3_daemon_commence(): start the daemon
|
||||
|
@ -78,8 +78,9 @@ _dawn_post_json(c3_c* url_c, uv_buf_t lod_u)
|
||||
hed_u = curl_slist_append(hed_u, "Content-Type: application/json");
|
||||
hed_u = curl_slist_append(hed_u, "charsets: utf-8");
|
||||
|
||||
// XX require TLS, pin default cert?
|
||||
|
||||
// XX require TLS, pin default cert?
|
||||
//
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, u3K.certs_c);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url_c);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _dawn_curl_alloc);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&buf_u);
|
||||
@ -124,8 +125,9 @@ _dawn_get_jam(c3_c* url_c)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// XX require TLS, pin default cert?
|
||||
|
||||
// XX require TLS, pin default cert?
|
||||
//
|
||||
curl_easy_setopt(curl, CURLOPT_CAINFO, u3K.certs_c);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url_c);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _dawn_curl_alloc);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&buf_u);
|
||||
|
@ -924,11 +924,13 @@ _pier_work_poke(void* vod_p,
|
||||
(c3n == u3r_cell(entry, &mug, &job)) ||
|
||||
(c3n == u3ud(mug)) ||
|
||||
(1 < u3r_met(5, mug)) ) {
|
||||
u3z(entry);
|
||||
goto error;
|
||||
}
|
||||
|
||||
c3_l mug_l = u3r_word(0, mug);
|
||||
if ( !wit_u || (mug_l && (mug_l != wit_u->mug_l)) ) {
|
||||
u3z(entry);
|
||||
goto error;
|
||||
}
|
||||
#ifdef VERBOSE_EVENTS
|
||||
@ -936,6 +938,7 @@ _pier_work_poke(void* vod_p,
|
||||
#endif
|
||||
|
||||
_pier_work_replace(wit_u, u3k(job));
|
||||
u3z(entry);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user