24
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
|
var time: lib.store.timepoint
if at:cmp('top') then
time = lib.osclock.time(nil)
else
var tp, ok = lib.math.decparse(at)
if ok then time = tp end
end
lib.io.fmt('from-time: %llu\n', time)
var posts = co.srv:post_enum_author_uid(uid, lib.store.range {
mode = 1; -- time -> idx
from_time = time;
to_idx = 65;
})
var oldest = time
json:lpush',"partOf":"https://':ppush(co.srv.cfg.domain):ppush(path)
:lpush'","type":"CollectionPage","orderedItems":['
if posts.sz > 0 then defer posts:free()
for i=0, lib.math.smallest(posts.sz,64) do
if i~=0 then json:lpush',' end
json:ppush(lib.api.lp.tweet(co,posts(i).ptr,true))
oldest = lib.math.smallest(posts(i)().posted, oldest)
end
end
json:lpush'],"totalItems":':ipush(posts.sz)
if oldest ~= time and oldest > 0 and posts.sz > 64 then
json:lpush',"next":"https://':ppush(co.srv.cfg.domain):ppush(path)
:lpush'?at=':ipush(oldest-1):lpush'"'
end
|
|
24
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
|
var time: lib.store.timepoint
if at:cmp('top') then
time = lib.osclock.time(nil)
else
var tp, ok = lib.math.decparse(at)
if ok then time = tp end
end
var posts = co.srv:post_enum_author_uid(uid, lib.store.range {
mode = 1; -- time -> idx
from_time = time;
to_idx = 65;
})
var oldest = time
json:lpush',"partOf":"https://':ppush(co.srv.cfg.domain):ppush(path)
:lpush'","type":"CollectionPage","orderedItems":['
if posts.sz > 0 then defer posts:free()
for i=0, lib.math.smallest(posts.sz,64) do
if i~=0 then json:lpush',' end
json:ppush(lib.api.lp.tweet(co,posts(i).ptr,true))
oldest = lib.math.smallest(posts(i)().posted, oldest)
posts(i):free()
end
end
json:lpush'],"totalItems":':ipush(posts.sz)
if oldest ~= time and oldest > 0 and posts.sz > 64 then
json:lpush',"next":"https://':ppush(co.srv.cfg.domain):ppush(path)
:lpush'?at=':ipush(oldest-1):lpush'"'
end
|