Overview
| Comment: | iterating |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
050ce7d4fce81f6c7df4c14c22e80eba |
| User & Date: | lexi on 2021-01-25 14:38:36 |
| Other Links: | manifest | tags |
Context
|
2021-01-28
| ||
| 00:51 | wrote mimelib, continued iterating on litepub support; tweets can now be imported into honk check-in: c774e2c5a9 user: lexi tags: trunk | |
|
2021-01-25
| ||
| 14:38 | iterating check-in: 050ce7d4fc user: lexi tags: trunk | |
| 13:24 | finish up LP support for user outbox views check-in: 3f080eded4 user: lexi tags: trunk | |
Changes
Modified backend/pgsql.t from [040ddf2134] to [18ea7fb9d0].
901 901 buf[3] = sz 902 902 for j=0,sz do buf[4 + j] = i.v6[j] end -- 😬 903 903 return buf 904 904 end 905 905 end; 906 906 } 907 907 908 -local sqlvars = {} 908 +local sqlvars = { 909 + -- unforunately necessary to generate IDs that fill the whole 910 + -- address space (due to floating-point shenanigans); there's 911 + -- just no good way of doing this with SQL 912 + ['def:uniq'] = [[bigint primary key default ( 913 + (random() * ((1::bigint << 32) - 1) )::bigint << 32 | 914 + (random() * ((1::bigint << 32) - 2) + 1)::bigint 915 + )]] 916 +} 909 917 for i, n in ipairs(lib.store.noticetype.members) do 910 918 sqlvars['notice:' .. n] = lib.store.noticetype[n]:asvalue() 911 919 end 912 920 913 921 for i, n in ipairs(lib.store.relation.members) do 914 922 sqlvars['rel:' .. n] = lib.store.relation.idvmap[n] 915 923 end ................................................................................ 974 982 var ipbuf: int8[20] 975 983 ;[pqt[lib.store.inet](false)]([args[i]], [&uint8](&ipbuf)) 976 984 in &ipbuf[0] end 977 985 dumpers[#dumpers+1] = `lib.io.fmt([tostring(i)..'. got inet\n']) 978 986 elseif ty.ptr_basetype == int8 or ty.ptr_basetype == uint8 then 979 987 counters[i] = `[args[i]].ct 980 988 casts[i] = `[&int8]([args[i]].ptr) 981 - dumpers[#dumpers+1] = `lib.io.fmt([tostring(i)..'. got ptr %llu %.*s\n'], [args[i]].ct, [args[i]].ct, [args[i]].ptr) 989 + dumpers[#dumpers+1] = `lib.io.fmt([tostring(i)..'. got ptr %p %.*s\n'], [args[i]].ct, [args[i]].ct, [args[i]].ptr) 982 990 elseif ty.ptr_basetype == bool then 983 991 counters[i] = `1 984 992 casts[i] = `[&int8]([args[i]].ptr) 985 993 -- dumpers[#dumpers+1] = `lib.io.fmt([tostring(i)..'. got bool = %hhu\n'], @[args[i]].ptr) 986 994 elseif ty:isintegral() then 987 995 counters[i] = ty.bytes 988 996 casts[i] = `[&int8](&[args[i]])
Modified backend/schema/pgsql.sql from [daac991db5] to [4c18dab250].
13 13 -- ('policy-security',:'secmode'), 14 14 -- ('policy-self-register',:'regpol'), 15 15 -- ('master',:'admin'), 16 16 17 17 -- note that valid ids should always > 0, as 0 is reserved for null 18 18 -- on the client side, vastly simplifying code 19 19 create table parsav_servers ( 20 - id bigint primary key default (1+random()*(2^63-1))::bigint, 20 + id <def:uniq>, 21 21 domain text not null unique, 22 22 key bytea, 23 23 knownsince bigint, 24 24 parsav boolean -- whether to use parsav protocol extensions 25 25 ); 26 26 comment on table parsav_servers is 27 27 'all servers known to the parsav instance. the local server (including its private key) is stored in row (id = 0)'; 28 28 29 29 create table parsav_actors ( 30 - id bigint primary key default (1+random()*(2^63-1))::bigint, 30 + id <def:uniq>, 31 31 nym text, 32 32 handle text not null, -- nym [@handle@origin] 33 33 origin bigint references parsav_servers(id) 34 34 on delete cascade, -- null origin = local actor 35 35 knownsince bigint not null, 36 36 bio text, 37 37 avatarid bigint, -- artifact id, null if remote ................................................................................ 58 58 primary key (key,actor) 59 59 ); 60 60 create index on parsav_rights (actor); 61 61 comment on table parsav_rights is 62 62 'a backward-compatible list of every non-default privilege or deprivilege granted to a local user'; 63 63 64 64 create table parsav_posts ( 65 - id bigint primary key default (1+random()*(2^63-1))::bigint, 65 + id <def:uniq>, 66 66 author bigint references parsav_actors(id) on delete cascade, 67 67 subject text, 68 68 acl text not null default 'all', -- just store the script raw 🤷 69 69 body text, 70 70 posted bigint not null, 71 71 discovered bigint not null, 72 72 chgcount integer not null default 0, ................................................................................ 94 94 95 95 primary key (relator, relatee, kind) 96 96 ); 97 97 comment on table parsav_rels is 98 98 'all relationships, positive and negative, between local users and other users; kind is a version-specific integer mapping to a type-of-relationship enum in store.t'; 99 99 100 100 create table parsav_acts ( 101 - id bigint primary key default (1+random()*(2^63-1))::bigint, 101 + id <def:uniq>, 102 102 kind text not null, -- like, rt, react, so on 103 103 time bigint not null, 104 104 actor bigint references parsav_actors(id) on delete cascade, 105 105 subject bigint, -- may be post or act, depending on kind 106 106 body text -- emoji, if react; complaint, if report 107 107 ); 108 108 create index on parsav_acts (subject); ................................................................................ 109 109 create index on parsav_acts (actor); 110 110 create index on parsav_acts (time); 111 111 comment on table parsav_acts is 112 112 'every simple action taken on a tweet by an actor, including likes, rts, reacts, and reports'; 113 113 114 114 create table parsav_log ( 115 115 -- accesses are tracked for security & sending delete acts 116 - id bigint primary key default (1+random()*(2^63-1))::bigint, 116 + id <def:uniq>, 117 117 time bigint not null, 118 118 actor bigint references parsav_actors(id) 119 119 on delete cascade, 120 120 post bigint not null 121 121 ); 122 122 comment on table parsav_log is 123 123 'a log of accesses from foreign servers, tracking which will be sent update & delete events for each post'; 124 124 125 125 create table parsav_artifacts ( 126 - id bigint primary key default (1+random()*(2^63-1))::bigint, 126 + id <def:uniq>, 127 127 birth bigint not null, 128 128 content bytea, -- if null, this is a "ban record" preventing content matching the hash from being re-uploaded 129 129 hash bytea unique not null, -- sha256 hash of content 130 130 -- it would be cool to use a computed column for this, but i don't want 131 131 -- to lock people into PG12 or drag in the pgcrypto extension just for this 132 132 mime text -- null if unknown, will be reported as octet-stream 133 133 ); ................................................................................ 146 146 ); 147 147 create index on parsav_artifact_claims (uid); 148 148 create index on parsav_artifact_claims (uid,folder); 149 149 comment on table parsav_artifact_claims is 150 150 'a list of users who have an ownership interest in each artifact (effectively an index of GC roots)'; 151 151 152 152 create table parsav_circles ( 153 - id bigint primary key default (1+random()*(2^63-1))::bigint, 153 + id <def:uniq>, 154 154 owner bigint not null references parsav_actors(id) on delete cascade, 155 155 name text not null, 156 156 members bigint[] not null default array[]::bigint[], 157 157 158 158 unique (owner,name) 159 159 ); 160 160 create index on parsav_circles (owner); 161 161 162 162 create table parsav_rooms ( 163 - id bigint primary key default (1+random()*(2^63-1))::bigint, 163 + id <def:uniq>, 164 164 origin bigint references parsav_servers(id) on delete cascade, 165 165 name text not null, 166 166 description text not null, 167 167 policy smallint not null 168 168 ); 169 169 comment on table parsav_rooms is 170 170 'an index of user-created chatrooms'; ................................................................................ 177 177 title text, -- admin-granted title like reddit flair 178 178 vouchedby bigint references parsav_actors(id) on delete set null 179 179 ); 180 180 create index on parsav_room_members (member); 181 181 create index on parsav_room_members (room); 182 182 183 183 create table parsav_invites ( 184 - id bigint primary key default (1+random()*(2^63-1))::bigint, 184 + id <def:uniq>, 185 185 -- when a user is created from an invite, the invite is deleted and the invite 186 186 -- ID becomes the user ID. privileges granted on the invite ID during the invite 187 187 -- process are thus inherited by the user 188 188 issuer bigint references parsav_actors(id) on delete set null, 189 189 handle text, -- admin can lock invite to specific handle 190 190 rank smallint not null default 0, 191 191 quota integer not null default 1000 192 192 ); 193 193 comment on table parsav_invites is 194 194 'all active invitations and the level of authority they grant if accepted'; 195 195 196 196 create table parsav_sanctions ( 197 - id bigint primary key default (1+random()*(2^63-1))::bigint, 197 + id <def:uniq>, 198 198 issuer bigint references parsav_actors(id) on delete set null, 199 199 scope bigint, -- can be null or room for local actions 200 200 nature smallint not null, -- silence, suspend, disemvowel, censor, noreply, etc 201 201 victim bigint not null, -- can be user, room, or post 202 202 expire bigint, -- auto-expires if set 203 203 review bigint, -- brings up for review at given time if set 204 204 reason text, -- visible to victim if set
Modified crypt.t from [034fdb64c7] to [a12c25b6dd].
81 81 else 82 82 return lib.pk.mbedtls_pk_write_key_pem(key, buf, const.maxpemsz) == 0 83 83 end 84 84 end 85 85 86 86 local binblob = lib.mem.ptr(uint8) 87 87 terra m.der(pub: bool, key: &ctx, buf: &uint8): binblob 88 - var ofs: intptr 88 + var ofs: ptrdiff 89 89 if pub then 90 90 ofs = lib.pk.mbedtls_pk_write_pubkey_der(key, buf, const.maxdersz) 91 91 else 92 92 ofs = lib.pk.mbedtls_pk_write_key_der(key, buf, const.maxdersz) 93 93 end 94 + if ofs < 0 then return binblob.null() end 94 95 return binblob { 95 96 ptr = buf + (const.maxdersz - ofs); 96 97 ct = ofs; 97 98 } 98 99 end 99 100 100 101 m.destroy = lib.dispatch {
Modified mgtool.t from [4fc07a70c1] to [63607cdb2b].
284 284 return 1 285 285 end 286 286 if dbmode.arglist.ct < 1 then goto cmderr end 287 287 288 288 srv:setup(cnf) 289 289 if lib.str.cmp(dbmode.arglist(0),'init') == 0 and dbmode.arglist.ct == 2 then 290 290 lib.report('initializing new database structure for domain ', dbmode.arglist(1)) 291 - dlg:tx_enter() 291 + --dlg:tx_enter() 292 292 if dlg:dbsetup() then 293 293 srv:conprep(lib.store.prepmode.conf) 294 294 295 295 do var newkp = lib.crypt.genkp() 296 296 -- generate server privkey 297 297 var kbuf: uint8[lib.crypt.const.maxdersz] 298 - var derkey = lib.crypt.der(false,&newkp, kbuf) 298 + var derkey = lib.crypt.der(false,&newkp, &kbuf[0]) 299 + if not derkey then 300 + lib.bail('could not write out DER form of server pubkey!') 301 + end 299 302 dlg:server_setup_self(dbmode.arglist(1), derkey) 300 303 end 301 304 302 305 dlg:conf_set('instance-name', dbmode.arglist(1)) 303 306 dlg:conf_set('domain', dbmode.arglist(1)) 304 307 do var sec: int8[65] gensec(&sec[0]) 305 308 dlg:conf_set('server-secret', &sec[0]) 306 309 end 307 310 lib.report('database setup complete; use mkroot to create an administrative user') 308 311 else lib.bail('initialization process interrupted') end 309 - dlg:tx_complete() 312 + --dlg:tx_complete() 310 313 elseif lib.str.cmp(dbmode.arglist(0),'obliterate') == 0 then 311 314 var cfmstr: int8[64] gen_cfstr(&cfmstr[0],0) 312 315 313 316 if dbmode.arglist.ct == 1 then 314 317 lib.bail('you are attempting to completely obliterate all data! make sure you have selected your target correctly. if you really want to do this, pass the confirmation string ', &cfmstr[0]) 315 318 elseif dbmode.arglist.ct == 2 then 316 319 if lib.str.cmp(dbmode.arglist(1), cfmstr) == 0 then
Modified route.t from [db07af2616] to [56f7ddd740].
510 510 end 511 511 end 512 512 return quote 513 513 var [me] 514 514 [check] 515 515 in [me] end 516 516 end)()] 517 - privs:dump() 518 517 if privs:sz() > 0 then 519 518 lib.dbg('installing credential restrictions') 520 519 lib.io.fmt('on priv %llu\n',aid) 521 520 co.srv:auth_privs_set(aid, privs) 522 521 end 523 522 524 523 lib.dbg('setting netmask restrictions')