Overview
| Comment: | fix privilege bugs, make visible and shout actually do things |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
611a3210269d407ce56c2e640360c9e8 |
| User & Date: | lexi on 2022-11-04 16:49:18 |
| Other Links: | manifest | tags |
Context
|
2025-02-07
| ||
| 11:06 | move back to AGPLv3 away from extremely sketchy EUPL; fix stinkscrape invocation; update authmech list check-in: ce454cea05 user: lexi tags: trunk | |
|
2022-11-04
| ||
| 16:49 | fix privilege bugs, make visible and shout actually do things check-in: 611a321026 user: lexi tags: trunk | |
| 12:45 | begin steps to port parsav to mbedtls3 and modern nix. also? fuck mbedtls with a fucking jackhammer i am never using it again holy fuck check-in: e7e16156a6 user: lexi tags: trunk | |
Changes
Modified backend/pgsql.t from [8e095d7d59] to [223be568a8].
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
local schema = sqlsquash(lib.util.ingest 'backend/schema/pgsql.sql')
local obliterator = sqlsquash(lib.util.ingest 'backend/schema/pgsql-drop.sql')
local privupdate = terra(
src: &lib.store.source,
ac: &lib.store.actor
): {}
var pdef: lib.store.powerset pdef:clear()
var map = array([privmap])
for i=0, [map.type.N] do
var d = pdef and map[i].val
var u = ac.rights.powers and map[i].val
queries.actor_power_delete.exec(src, ac.id, map[i].name)
if d:sz() > 0 and u:sz() == 0 then
lib.dbg('blocking power ', {map[i].name.ptr, map[i].name.ct})
queries.actor_power_insert.exec(src, ac.id, map[i].name, 0)
elseif d:sz() == 0 and u:sz() > 0 then
lib.dbg('granting power ', {map[i].name.ptr, map[i].name.ct})
queries.actor_power_insert.exec(src, ac.id, map[i].name, 1)
end
end
end
local getpow = terra(
|
| | | |
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
local schema = sqlsquash(lib.util.ingest 'backend/schema/pgsql.sql')
local obliterator = sqlsquash(lib.util.ingest 'backend/schema/pgsql-drop.sql')
local privupdate = terra(
src: &lib.store.source,
ac: &lib.store.actor
): {}
var pdef = lib.store.rights_default().powers
var map = array([privmap])
for i=0, [map.type.N] do
var d = pdef and map[i].val
var u = ac.rights.powers and map[i].val
queries.actor_power_delete.exec(src, ac.id, map[i].name)
if d:any() and u:sz() == 0 then
lib.dbg('blocking power ', {map[i].name.ptr, map[i].name.ct})
queries.actor_power_insert.exec(src, ac.id, map[i].name, 0)
elseif d:any() == false and u:sz() > 0 then
lib.dbg('granting power ', {map[i].name.ptr, map[i].name.ct})
queries.actor_power_insert.exec(src, ac.id, map[i].name, 1)
end
end
end
local getpow = terra(
|
Modified makefile from [21260c66fc] to [814abb2313].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
version = dev
dl = git
dbg-flags = $(if $(dbg),-g)
# for nix
prefix = ${out}
images = static/default-avatar.webp static/query.webp static/heart.webp static/retweet.webp static/reply.webp static/file.webp static/follow.webp
#$(addsuffix .webp, $(basename $(wildcard static/*.svg)))
styles = $(addsuffix .css, $(basename $(wildcard static/*.scss)))
# .PHONY: all
# all: parsav parsavd
parsav parsavd: parsav.t config.lua pkgdata.lua $(images) $(styles)
terra $(dbg-flags) $<
parsav.o parsavd.o: parsav.t config.lua pkgdata.lua $(images) $(styles)
env parsav_link=no terra $(dbg-flags) $<
parsav.ll parsavd.ll: parsav.t config.lua pkgdata.lua $(images) $(styles)
env parsav_emit_type=ll parsav_link=no terra $(dbg-flags) $<
parsav.s parsavd.ss: parsav.ll
llc --march=$(target) $<
static/%.svg.clean: static/%.svg
svgcleaner $< $@
static/%.webp: static/%.png
cwebp -q 90 $< -o $@
|
| | | | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
version = dev dl = git dbg-flags = $(if $(dbg),-g) build-vars = parsav_enable_debug=$(if $(dbg),yes,no) # for nix prefix = ${out} images = static/default-avatar.webp static/query.webp static/heart.webp static/retweet.webp static/reply.webp static/file.webp static/follow.webp #$(addsuffix .webp, $(basename $(wildcard static/*.svg))) styles = $(addsuffix .css, $(basename $(wildcard static/*.scss))) # .PHONY: all # all: parsav parsavd parsav parsavd: parsav.t config.lua pkgdata.lua $(images) $(styles) env $(build-vars) terra $(dbg-flags) $< parsav.o parsavd.o: parsav.t config.lua pkgdata.lua $(images) $(styles) env $(build-vars) parsav_link=no terra $(dbg-flags) $< parsav.ll parsavd.ll: parsav.t config.lua pkgdata.lua $(images) $(styles) env $(build-vars) parsav_emit_type=ll parsav_link=no terra $(dbg-flags) $< parsav.s parsavd.ss: parsav.ll llc --march=$(target) $< static/%.svg.clean: static/%.svg svgcleaner $< $@ static/%.webp: static/%.png cwebp -q 90 $< -o $@ |
Modified parsav.t from [04815ba40d] to [db2ced38ab].
278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
set.idvmap = o
set.null = quote var s: set s:clear() in s end
set.name = string.format('set<%s>', table.concat(tbl, '|'))
set.metamethods.__entrymissing = macro(function(val, obj)
if o[val] == nil then error('value ' .. val .. ' not in set') end
return `bit { _v=[o[val] - 1], _set = &(obj) }
end)
terra set:sz()
var ct: intptr = 0
--for i = 0, [math.floor(#tbl/8)] do
-- ct = ct + lib.math.ll.ctpop_u8(self._store[i])
--end
--[(function()
-- if #tbl % 8 ~= 0 then
|
> > > > > > |
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
set.idvmap = o
set.null = quote var s: set s:clear() in s end
set.name = string.format('set<%s>', table.concat(tbl, '|'))
set.metamethods.__entrymissing = macro(function(val, obj)
if o[val] == nil then error('value ' .. val .. ' not in set') end
return `bit { _v=[o[val] - 1], _set = &(obj) }
end)
terra set:any()
for i = 0, bytes - 1 do
if self._store[i] ~= 0 then return true end
end
return false
end
terra set:sz()
var ct: intptr = 0
--for i = 0, [math.floor(#tbl/8)] do
-- ct = ct + lib.math.ll.ctpop_u8(self._store[i])
--end
--[(function()
-- if #tbl % 8 ~= 0 then
|
Modified render/timeline.t from [5c434424ea] to [0ee70a00a0].
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
var spec = lib.str.ref.null()
if hpath.ct >= 2 then
modestr = hpath(1)
if hpath.ct >= 3 then spec = hpath(2) end
end
var mode = modes.follow
var circle: uint64 = 0
if modestr:ref() then
if modestr:cmp('local' ) then mode = [modes['local']]
elseif modestr:cmp('mutual') then mode = modes.mutual
elseif modestr:cmp('fedi' ) then mode = modes.fedi
elseif modestr:cmp('circle') then mode = modes.circle
end
end
if requires_login(mode) and co.aid == 0 then mode = [modes['local']] end
var stoptime = lib.osclock.time(nil)
................................................................................
for i = 0, posts.sz do
var author = co:uid2actor(posts(i).ptr.author)
if mode == modes.mutual and posts(i).ptr.author ~= co.who.id then
if not author.relationship.recip.follow() then goto skip end
end
if author.relationship.rel.mute() or
author.relationship.rel.avoid() or
author.relationship.recip.exclude() then goto skip end
if posts(i).ptr.rtdby ~= 0 then
var rter = co:uid2actor(posts(i).ptr.rtdby)
if rter.relationship.rel.mute()
or rter.relationship.rel.attenuate()
or rter.relationship.rel.avoid()
or rter.relationship.recip.exclude() then goto skip end
end
lib.render.tweet(co, posts(i).ptr, &acc)
var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited)
if t > newest then newest = t end
::skip:: posts(i):free()
end
if posts.run > 0 then posts:free() end
|
>
>
>
|
|
|
>
>
|
>
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
var spec = lib.str.ref.null() if hpath.ct >= 2 then modestr = hpath(1) if hpath.ct >= 3 then spec = hpath(2) end end var mode = modes.follow var circle: uint64 = 0 var reqPowers: lib.store.powerset reqPowers:clear() reqPowers.visible = true if modestr:ref() then if modestr:cmp('local' ) then mode = [modes['local']] reqPowers.shout = true elseif modestr:cmp('mutual') then mode = modes.mutual elseif modestr:cmp('fedi' ) then mode = modes.fedi reqPowers.shout = true elseif modestr:cmp('circle') then mode = modes.circle end end if requires_login(mode) and co.aid == 0 then mode = [modes['local']] end var stoptime = lib.osclock.time(nil) ................................................................................ for i = 0, posts.sz do var author = co:uid2actor(posts(i).ptr.author) if mode == modes.mutual and posts(i).ptr.author ~= co.who.id then if not author.relationship.recip.follow() then goto skip end end if author.relationship.rel.mute() or author.relationship.rel.avoid() or author.relationship.recip.exclude() or (not ((author.rights.powers and reqPowers) == reqPowers)) then goto skip end if posts(i).ptr.rtdby ~= 0 then var rter = co:uid2actor(posts(i).ptr.rtdby) if rter.relationship.rel.mute() or rter.relationship.rel.attenuate() or rter.relationship.rel.avoid() or rter.relationship.recip.exclude() or (not ((rter.rights.powers and reqPowers) == reqPowers)) then goto skip end end lib.render.tweet(co, posts(i).ptr, &acc) var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited) if t > newest then newest = t end ::skip:: posts(i):free() end if posts.run > 0 then posts:free() end |
Modified route.t from [5d2607bf9b] to [38909346ca].
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
if not msg then msg = 'user record updated' end
end
end
elseif path.ct == 2 and meth == method.post then
var act = co:ppostv('act')
if act:cmp('create') then
var newname = co:ppostv('handle')
if not newname or not lib.store.actor.handle_validate(newname.ptr) then
co:complain(400,'invalid handle','the handle you have requested is not valid')
end
var tu = co.srv:actor_fetch_xid(newname)
if tu:ref() then tu:free()
co:complain(409,'handle clash','that handle conflicts with one that already exists')
return
end
var kbuf: uint8[lib.crypt.const.maxdersz]
|
| > |
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 |
if not msg then msg = 'user record updated' end
end
end
elseif path.ct == 2 and meth == method.post then
var act = co:ppostv('act')
if act:cmp('create') then
var newname = co:ppostv('handle')
if (not newname) or (not lib.store.actor.handle_validate(newname)) then
co:complain(400,'invalid handle','the handle you have requested is not valid')
return
end
var tu = co.srv:actor_fetch_xid(newname)
if tu:ref() then tu:free()
co:complain(409,'handle clash','that handle conflicts with one that already exists')
return
end
var kbuf: uint8[lib.crypt.const.maxdersz]
|
Modified store.t from [54bd5bc381] to [093a07dfdc].
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
-- otherwise, nobody could reset their passwords -- (also dissuades people from giving root lightly) return true end return self:outranks(other) end terra m.actor.methods.handle_validate(hnd: rawstring) if hnd[0] == 0 then return false end -- TODO validate fully return true end terra m.actor.methods.mk(kbuf: &uint8) |
| | |
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
-- otherwise, nobody could reset their passwords -- (also dissuades people from giving root lightly) return true end return self:outranks(other) end terra m.actor.methods.handle_validate(hnd: pstr) if hnd.ct == 0 then return false end -- TODO validate fully return true end terra m.actor.methods.mk(kbuf: &uint8) |