parsav  Check-in [7af9e0961e]

Overview
Comment:defuckulate bytestream_trusted
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7af9e0961eabde0dff916b241ce4397dd568d7ac41d5b4e2d3f96d0323078ba7
User & Date: lexi on 2021-01-22 17:18:52
Other Links: manifest | tags
Context
2021-01-22
17:22
improve compose icon check-in: db0e155b9d user: lexi tags: trunk
17:18
defuckulate bytestream_trusted check-in: 7af9e0961e user: lexi tags: trunk
16:48
somewhat defuckulate build system check-in: 251b382f5c user: lexi tags: trunk
Changes

Modified render/conf/users.t from [2f981259f7] to [8a313a02c7].

301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
			end

			if co.who.id ~= uid and co.who.rights.powers.purge() then
				var purgeconf = co:stra(48)
				var purgestrs = array(
					'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'eta', 'nu', 'kappa',
					'emerald', 'carnelian', 'sapphire', 'ruby', 'amethyst', 'glory',
					'hope', 'grace', 'pearl', 'carnation', 'rose', 'peony', 'poppy'

				)
				for i=0,3 do
					purgeconf:push(purgestrs[lib.crypt.random(intptr,0,[purgestrs.type.N])],0)
					if i ~= 2 then purgeconf:lpush('-') end
				end
				cinp:lpush('<details><summary>purge account</summary><p>you have the authority to destroy this account and all its associated content irreversibly and irretrievably. if you really wish to apply such an extreme sanction, enter the confirmation string <strong style="user-select:none">'):push(purgeconf.buf,purgeconf.sz):lpush('</strong> below and press the “alter” button to begin the process.</p><div class="elem"><label for="purge">purge confirmation string</label><input type="text" id="purge" name="purgekey"></div><input type="hidden" name="purgestr" value="'):push(purgeconf.buf,purgeconf.sz):lpush('"></details>')
				--purgeconf:free()







|
>







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
			end

			if co.who.id ~= uid and co.who.rights.powers.purge() then
				var purgeconf = co:stra(48)
				var purgestrs = array(
					'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'eta', 'nu', 'kappa',
					'emerald', 'carnelian', 'sapphire', 'ruby', 'amethyst', 'glory',
					'hope', 'grace', 'pearl', 'carnation', 'rose', 'peony', 'poppy',
					'perihelion', 'aphelion'
				)
				for i=0,3 do
					purgeconf:push(purgestrs[lib.crypt.random(intptr,0,[purgestrs.type.N])],0)
					if i ~= 2 then purgeconf:lpush('-') end
				end
				cinp:lpush('<details><summary>purge account</summary><p>you have the authority to destroy this account and all its associated content irreversibly and irretrievably. if you really wish to apply such an extreme sanction, enter the confirmation string <strong style="user-select:none">'):push(purgeconf.buf,purgeconf.sz):lpush('</strong> below and press the “alter” button to begin the process.</p><div class="elem"><label for="purge">purge confirmation string</label><input type="text" id="purge" name="purgekey"></div><input type="hidden" name="purgestr" value="'):push(purgeconf.buf,purgeconf.sz):lpush('"></details>')
				--purgeconf:free()

Modified srv.t from [113b729c73] to [c8974a3f52].

308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
end

terra convo:stdpage(pg: convo.page) self:statpage(200, pg) end

terra convo:bytestream_trusted(lockdown: bool, mime: pstring, data: lib.mem.ptr(uint8))
	var lockhdr = "Content-Security-Policy: sandbox; default-src 'none'; form-action 'none'; navigate-to 'none';\r\n"
	if not lockdown then lockhdr = "" end
	lib.net.mg_printf(self.con, "HTTP/1.1 200 OK\r\nContent-Type: %.*s\r\nContent-Length: %llu\r\n%sX-Content-Options: nosniff\r\n\r\n", mime.ct, mime.ptr, data.ct + 2, lockdown)
	lib.net.mg_send(self.con, data.ptr, data.ct)
	lib.net.mg_send(self.con, '\r\n', 2)
end

terra convo:json(data: pstring)
	self:bytestream_trusted(false, 'application/ld+json', data:blob())
end







|







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
end

terra convo:stdpage(pg: convo.page) self:statpage(200, pg) end

terra convo:bytestream_trusted(lockdown: bool, mime: pstring, data: lib.mem.ptr(uint8))
	var lockhdr = "Content-Security-Policy: sandbox; default-src 'none'; form-action 'none'; navigate-to 'none';\r\n"
	if not lockdown then lockhdr = "" end
	lib.net.mg_printf(self.con, "HTTP/1.1 200 OK\r\nContent-Type: %.*s\r\nContent-Length: %llu\r\n%sX-Content-Options: nosniff\r\n\r\n", mime.ct, mime.ptr, data.ct + 2, lockhdr)
	lib.net.mg_send(self.con, data.ptr, data.ct)
	lib.net.mg_send(self.con, '\r\n', 2)
end

terra convo:json(data: pstring)
	self:bytestream_trusted(false, 'application/ld+json', data:blob())
end

Modified static/style.scss from [cb730b53e2] to [70dd348543].

969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985





986
987
988
989
990
991
992
....
1000
1001
1002
1003
1004
1005
1006



1007
1008
1009
1010
1011
1012
1013
1014
	margin: 0.3em 0;
	details & { border: none; background: none; }
	> input[type="radio"], > input[type="checkbox"] {
		display: none;
		&+label {
			display: block;
			flex-grow: 1;
			padding: 0.08in 0.05in;
			margin: 0.03in;
			flex-basis: 15%;
			cursor: pointer;
			transition: 0.3s;
			text-align: center;
			border: 1px solid transparent;
			text-shadow: 1px 1px black;
			color: otone(15%);
			border-radius: 4px;





			&:nth-child(7n+1) { --co: -10 } //silly hack
			&:nth-child(7n+2) { --co: -35 }
			&:nth-child(7n+3) { --co: -20 }
			&:nth-child(7n+4) { --co: -50 }
			&:nth-child(7n+5) { --co: -40 }
			&:nth-child(7n+6) { --co: -5  }
			&:nth-child(7n+7) { --co: -25 }
................................................................................
			border-bottom: 1px solid otone(-50%);
			background: linear-gradient(to bottom, otone(-25%,-0.2), otone(-28%,-0.3) 35%, otone(-30%,-0.5));
			color: white;
			box-shadow: 0 0 0 1px tone(-60%);
			&:hover {
				border-top: 1px solid otone(10%);
				border-bottom: 1px solid otone(-60%);



				font-weight: bold;
			}
		}
	}
}

details {
	//border: 1px solid tone(-60%);







|

<




|

|
>
>
>
>
>







 







>
>
>
|







969
970
971
972
973
974
975
976
977

978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
....
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
	margin: 0.3em 0;
	details & { border: none; background: none; }
	> input[type="radio"], > input[type="checkbox"] {
		display: none;
		&+label {
			display: block;
			flex-grow: 1;
			padding: 0.06in 0.05in;
			margin: 0.03in;

			cursor: pointer;
			transition: 0.3s;
			text-align: center;
			border: 1px solid transparent;
			border-radius: 4px;
			color: otone(15%);
			text-shadow: 1px 1px black,
			// transition hints
				-0.04ex 0 transparent, 0.04ex 0 transparent,
				calc(-0.04ex + 1px) 1px transparent,
				calc(0.04ex + 1px) 1px transparent;

			&:nth-child(7n+1) { --co: -10 } //silly hack
			&:nth-child(7n+2) { --co: -35 }
			&:nth-child(7n+3) { --co: -20 }
			&:nth-child(7n+4) { --co: -50 }
			&:nth-child(7n+5) { --co: -40 }
			&:nth-child(7n+6) { --co: -5  }
			&:nth-child(7n+7) { --co: -25 }
................................................................................
			border-bottom: 1px solid otone(-50%);
			background: linear-gradient(to bottom, otone(-25%,-0.2), otone(-28%,-0.3) 35%, otone(-30%,-0.5));
			color: white;
			box-shadow: 0 0 0 1px tone(-60%);
			&:hover {
				border-top: 1px solid otone(10%);
				border-bottom: 1px solid otone(-60%);
				text-shadow: -0.04ex 0 white, 0.04ex 0 white,
					calc(-0.04ex + 1px) 1px black,
					calc(0.04ex + 1px) 1px black; // fake bold
				//font-weight: bold;
			}
		}
	}
}

details {
	//border: 1px solid tone(-60%);

Modified store.t from [0871cb7e85] to [c7ef550a1d].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43



44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	privset = lib.set {
		'post', 'edit', 'account', 'upload', 'artifact', 'moderate', 'admin', 'invite'
	};
	powerset = lib.set {
		-- user powers -- default on
		'login', -- not locked out
		'visible', -- account & posts can be seen by others

		'post', -- can do poasts
		'shout', -- posts show up on local timeline
		'propagate', -- posts are sent to other instances
		'artifact', -- upload, claim, and manage artifacts
		'account', -- configure own account
		'edit'; -- edit own poasts
		'snitch'; -- can issue badthink reports

		-- admin powers -- default off
		'purge', -- permanently delete users
		'config', -- change daemon policy & config UI
		'censor', -- dispose of badthink



		'discipline', -- enforced timeouts, stripping badges and epithets, punitive actions that do not permanently deprive of powers; can remove own injunctions but not others'
		'vacate', -- can remove others' injunctions, but not apply them
		'cred', -- alter credentials
		'elevate', 'demote', -- change user rank, give and take powers, including the ability to log in

		'rebrand', -- modify site's brand identity
		'herald', -- grant serverwide epithets and badges
		'crier', -- can promote content to the instance page
		'invite' -- *unlimited* invites
	};
	prepmode = lib.enum {
		'full','conf','admin'
	}
}

local function setmap(set)
	local map = {}
	local struct pt { name:lib.mem.ptr(int8), val:set }
	for k,v in pairs(set.members) do
		map[#map + 1] = quote
			var ps: set ps:clear()
			(ps.[v] << true)
		in pt {name = [v], val = ps} end
	end
	return map
end







>





<



<
<

>
>
>




>

<
|
<









|







25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40


41
42
43
44
45
46
47
48
49
50

51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	privset = lib.set {
		'post', 'edit', 'account', 'upload', 'artifact', 'moderate', 'admin', 'invite'
	};
	powerset = lib.set {
		-- user powers -- default on
		'login', -- not locked out
		'visible', -- account & posts can be seen by others
		'edit'; -- edit own poasts
		'post', -- can do poasts
		'shout', -- posts show up on local timeline
		'propagate', -- posts are sent to other instances
		'artifact', -- upload, claim, and manage artifacts
		'account', -- configure own account

		'snitch'; -- can issue badthink reports

		-- admin powers -- default off


		'censor', -- dispose of badthink
		'herald', -- grant serverwide epithets and badges
		'crier', -- can promote content to the instance page
		'invite', -- *unlimited* invites
		'discipline', -- enforced timeouts, stripping badges and epithets, punitive actions that do not permanently deprive of powers; can remove own injunctions but not others'
		'vacate', -- can remove others' injunctions, but not apply them
		'cred', -- alter credentials
		'elevate', 'demote', -- change user rank, give and take powers, including the ability to log in
		'config', -- change daemon policy & config UI
		'rebrand', -- modify site's brand identity

		'purge' -- permanently delete users

	};
	prepmode = lib.enum {
		'full','conf','admin'
	}
}

local function setmap(set)
	local map = {}
	local struct pt { name:lib.mem.ptr(int8), val:set }
	for i,v in ipairs(set.members) do
		map[#map + 1] = quote
			var ps: set ps:clear()
			(ps.[v] << true)
		in pt {name = [v], val = ps} end
	end
	return map
end