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
  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
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 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
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 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
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
.Dd October 15, 2026
.Dt CAMPUSWEB 1
.Os
.Sh NAME
.Nm campusweb
.Nd a mirror of one Stud.IP account, as HTML and text
.Sh SYNOPSIS
.Nm
.Op Fl -listen Ar addr
.Op Fl -origin Ar url
.Op Fl -db Ar path
.Op Fl -base-url Ar url
.Op Fl -poll Ar duration
.Op Fl -full Ar duration
.Op Fl -pause Ar duration
.Op Fl -max-file-size Ar bytes
.Op Fl -pdfjs-update Ns = Ns Ar bool
.Op Fl -timezone Ar zone
.Sh DESCRIPTION
.Nm
mirrors what one person's account sees on a Stud.IP installation \(en by
default Digicampus, Universit\(:at Augsburg \(en into one SQLite file, and
serves the mirror over HTTP as HTML and in the text rendering the mail
frontends of this tree use
.Pq Li text/llm .
.Pp
It mirrors, for every course the account is in, in every semester:
.Bl -bullet -compact
.It
course files, with their bytes, keeping every version a file has had;
.It
course news, and the site-wide announcements;
.It
the forum;
.It
the course dates
.Pq Dq Termine ;
.It
the wiki, and the lecturer's information pages, keeping every text a page has
had, see
.Sx PAGES ;
.El
and the account's Stud.IP messages, inbox and outbox.
.Pp
Nothing is deleted when it disappears upstream.
A file taken down by the lecturer stays readable here, marked as removed.
.Pp
Some things are not Stud.IP's: the reader's own notes on a PDF, made in the
viewer on its file page and kept beside the mirror, see
.Sx ANNOTATIONS ;
what the reader has seen of the changes, see
.Sx SEEN ;
and what was made from the course's files and read in them elsewhere, kept
with where it comes from: derived versions of files, such as the text of a
PDF, see
.Sx DERIVED VERSIONS ,
and claims about the course's dates, such as a session's topic read from a
seminar plan, see
.Sx CLAIMS ;
and files the reader adds to a course, such as the scan of a chapter the
seminar plan names but nobody uploaded, see
.Sx OWN FILES .
None of them goes upstream.
.Pp
.Nm
only ever sends GET requests to Stud.IP, and never asks for anything whose
reading would mark it read there; see
.Sx CAVEATS .
.Pp
It cannot log in on its own.
A person pastes a session cookie on
.Pa /login ;
when that session expires,
.Nm
says so on every page and stops syncing until a new one is pasted.
See
.Sx LOGGING IN ,
and
.Xr campusweb 7
for why there is no better way.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl -listen Ar addr
Default
.Li 127.0.0.1:8780 .
Must be a loopback address, a Tailscale address of this machine
.Pq Li 100.64.0.0/10 , Li fd7a:115c:a1e0::/48 ,
or
.Li unix:/ Ns Ar path
for a unix socket a reverse proxy connects to, created mode 0660 so that only
the owner and the group can; anything else, including
.Li 0.0.0.0 ,
is refused at startup, because
.Nm
has no authentication and whoever reaches it can read the mirror and replace
the session.
See
.Sx RUNNING ON A SERVER .
.It Fl -origin Ar url
Where
.Nm
is served, as a browser names it, such as
.Li https://campusweb.profpatsch.de ,
when it is behind a reverse proxy.
The Origin check on
.Li POST /login ,
.Li POST /sync
and
.Li POST /seen
compares against it.
Without it the check expects
.Li http://
and the request's own Host, which behind a TLS proxy would refuse every
legitimate paste.
.It Fl -db Ar path
Default
.Pa ~/.local/state/campusweb/campusweb.db .
Created mode 0600: it holds a live session cookie.
.It Fl -base-url Ar url
The Stud.IP installation.
Default
.Lk https://digicampus.uni-augsburg.de .
Anything running Stud.IP 5 or later with the JSON:API enabled should work.
.It Fl -poll Ar duration
Default
.Li 5m ,
at least
.Li 1m .
How often the activity stream and the message boxes are read, and the courses
the stream names synced.
This is also what keeps the session from expiring for idleness.
.It Fl -full Ar duration
Default
.Li 1h .
How often everything is synced: semesters, the course list, and every course.
.It Fl -pause Ar duration
Default
.Li 300ms .
The least time between two requests to Stud.IP.
.It Fl -max-file-size Ar bytes
Default 200 MiB.
A larger file is listed with its size and the reason it was not stored, and not
downloaded.
.It Fl -pdfjs-update
On by default.
Check GitHub at startup for a newer release of the pdf.js viewer and store it
in the database, in the background.
A failure is logged and ignored; without a stored viewer PDFs are not framed,
and
.Pa /file/ Ns Ar id Ns Pa /inline
still opens them in the browser's own viewer.
.Cm false
uses whatever is stored and contacts nobody.
This runs third-party JavaScript nobody has read; see
.Sx CAVEATS .
.It Fl -timezone Ar zone
Default
.Li Europe/Berlin .
Every time is shown in it and every date in
.Cm ?since=
and
.Cm ?until=
is read in it, whatever zone the host is set to.
A server usually runs in UTC, and without this a course at 08:15 would be shown
at 06:15 or 07:15.
.El
.Sh LOGGING IN
A new database has no session.
A person logs in to Digicampus in a browser, copies the value of the
.Li Studip_Session
cookie from the developer tools, and pastes it on
.Pa /login .
A whole
.Ql Cookie:\&
header, such as the one in Firefox's
.Dq Copy as cURL ,
is accepted too; only
.Li Studip_Session
and the load balancer's
.Li SRVNAME
are kept.
.Pp
The cookie is checked against
.Pa /jsonapi.php/v1/users/me
before it is stored, and a full sync starts at once.
A cookie of a different account than the one the mirror was made with is
refused.
.Pp
When Stud.IP answers a request with 401, or a page of the website with a
redirect to its login, the session is recorded as dead with the time and the
request, syncing stops, and every page says so.
Nothing is retried with a dead cookie.
.Pp
.Pa /status
lists every session with when it was pasted, the last request it answered, and
when it died.
That is the measurement of how long a pasted session lasts; see
.Sx THE SESSION
in
.Xr campusweb 7 .
.Sh SYNCING
A full run, at start, on
.Fl -full ,
after a login and on
.Li POST /sync :
.Bl -enum -compact
.It
the semesters;
.It
the account's course list \(en a course no longer in it is marked
.Dq left
and from then on kept as it was, not synced;
.It
both message boxes and the site-wide news;
.It
the activity stream, to move its cursor;
.It
for every course: folders and files, news, dates, forum, wiki, and \(en once a
day \(en the information pages.
.El
.Pp
A poll, every
.Fl -poll :
the activity stream since the last poll, both message boxes, and the content of
every course the stream mentions, other than for somebody joining or leaving
it.
.Pp
A file is downloaded when it has no stored version yet or Stud.IP reports a
different
.Li chdate
than the stored one was fetched at.
Bytes equal to the newest version's are not stored again; different bytes
become a new version and the old one stays.
Bytes are stored once per content, by SHA-256.
.Pp
Some entries in a Stud.IP file area are links \(en to a website, a video,
another course \(en and have no bytes.
For those the target is recorded and shown instead of a download.
.Pp
A forum discussion's postings are read only when its posting count or last
activity changed.
.Pp
One course failing does not stop the others, and one part of a course \(en say
a forum the course has switched off \(en does not stop its files.
A course whose last sync failed says why on its page and on
.Pa /status .
.Sh ROUTES
Every page answers HTML to a browser and
.Li text/llm
to a client that sends
.Li "Accept: text/llm"
or appends
.Li ?view=llm .
Every page takes
.Li ?semester= ,
see
.Sx SEMESTERS .
.Pp
Every route that answers stored bytes \(en a file's versions, inline or as
attachments, images, notes, derivations, the frame's document \(en carries the
SHA-256 of those bytes as a strong
.Li ETag ,
and answers
.Li If-None-Match
with 304,
.Li Range
with 206 and only the bytes asked for, and
.Li If-Range
with the range if the ETag still matches and the whole document otherwise.
pdf.js uses this to show a long PDF's first page before the rest has arrived.
An address that names one content \(en a version by its number, an image of
one, a derivation \(en is
.Li "Cache-Control: private, max-age=31536000, immutable" ;
one whose content changes \(en the newest version, the notes, the frame's
document \(en is
.Li "private, no-cache" ,
kept but revalidated by its ETag each time.
.Bl -tag -width Ds
.It Pa /
What changed, newest first: files new, changed or removed; news; messages;
forum postings; course dates added, moved, retimed, moved to another room,
cancelled, uncancelled or removed; wiki and information pages new, changed or
removed, a changed one with the lines it removed and added, the first twelve.
Dated by when it happened upstream where Stud.IP says, otherwise by when
.Nm
noticed.
Takes
.Li ?since=
and
.Li ?until=
as
.Xr mailweb 1
does
.Pq Li YYYY-MM-DD , today , yesterday , -7d ,
and
.Li ?limit= , ?offset= .
Above it, up to fifty changes not seen yet, with a form to mark them all seen;
.Li ?unseen=1
lists only those, all of them.
Also lists the course dates of the next seven days.
See
.Sx SEEN .
.It Pa /semesters
Semesters with a course in the mirror, newest first.
.It Pa /courses
The semester's courses, with their unseen changes, their file counts, and when
the newest change in each happened upstream, linked to it.
When a course was last synced is on its own page and, if it failed, on
.Pa /status .
.It Pa /course/ Ns Ar id
One course: its information pages, the folder tree with its files, the files
the reader added to it, news, dates, forum discussions and wiki, with what has
unseen changes marked, and a form to mark the course seen; and, at the end, the
fields of its details page
on Digicampus that are filled in \(en description, Sonstiges, Teilnehmende,
Voraussetzungen, Lernorganisation, Leistungsnachweis, ECTS-Punkte.
Opening it in a browser marks its date changes seen, since the dates are read
in full here.
Files removed upstream are hidden unless
.Li ?gone=1 .
.It Pa /course/ Ns Ar id Ns Pa /forum
The course's forum discussions.
.It Pa /folder/ Ns Ar id
One folder and everything below it, removed files included.
.It Pa /file/ Ns Ar id
One file: what Stud.IP says about it, every stored version, and the reader's
notes on them.
A stored PDF fills the window, in the pdf.js viewer, in a frame that may run
script and is denied campusweb's origin, so that the browser does not download
it; under it is a one-line bar naming the file and the version shown, and
below that the navigation and the rest of the page.
The viewer has the keyboard when the page opens, so space and the arrow keys
scroll the document.
When the system prefers dark, the pages are shown inverted, hues kept, so
a scan reads as light print on dark grey; photographs then look like
negatives, and what is saved is not affected.
The viewer shows the newest version that has notes, with them, or else the
newest version;
.Li ?version= Ns Ar n
shows version
.Ar n .
See
.Sx ANNOTATIONS .
.Pp
A stored Word document (.docx) is shown as its text under the details, the
newest version or
.Li ?version= Ns Ar n ,
in both renderings, with its images; above it, what the text leaves out.
See
.Sx WORD DOCUMENTS .
A stored presentation (.pptx) is shown the same way as its slides, each laid
out as in the file, with its speaker notes under it; see
.Sx PRESENTATIONS .
.Pp
A stored image a browser shows \(en PNG, JPEG, GIF or WebP, by its bytes \(en is
shown at most a window high, linked to its full size.
It is not inverted when the system prefers dark.
.It Pa /file/ Ns Ar id Ns Pa /content
The newest stored version's bytes, with the type Stud.IP recorded, as an
attachment.
404 with the reason when nothing is stored.
.It Pa /file/ Ns Ar id Ns Pa /version/ Ns Ar n
Version
.Ar n ,
counting from 1.
.It Pa /file/ Ns Ar id Ns Pa /inline
.It Pa /file/ Ns Ar id Ns Pa /version/ Ns Ar n Ns Pa /inline
The newest version, or version
.Ar n ,
typed
.Li application/pdf
and dispositioned inline, for the browser's own viewer; or, if the bytes are
a PNG, JPEG, GIF or WebP image, typed as that, for the file page.
404 for anything else, whatever Stud.IP or the name says \(en an SVG
included, which can carry script.
.It Pa /file/ Ns Ar id Ns Pa /version/ Ns Ar n Ns Pa /image/ Ns Ar k
Image
.Ar k
of the text of version
.Ar n
of a Word document or presentation, as listed in its text rendering.
Like every image,
.Li nosniff
and
.Li "Content-Security-Policy: sandbox" ,
and, since the address always names the same bytes, cached for a year.
An SVG picture of a presentation, the one place an SVG is served, is
additionally denied loading anything
.Pq Li "default-src 'none'" .
.It Pa /file/ Ns Ar id Ns Pa /version/ Ns Ar n Ns Pa /annotated
The reader's annotated copy of version
.Ar n ,
inline with the same headers as
.Pa /inline ,
or with
.Li ?download=1
as an attachment named like
.Ql "Folien (notes, v2).pdf" .
404 when that version has no notes.
.It Pa /frame/ Ns Ar cap Ns Pa /pdf
.It Li POST Pa /frame/ Ns Ar cap Ns Pa /notes
.It Li POST Pa /frame/ Ns Ar cap Ns Pa /position
The viewer frame's own three routes, and the only ones it fetches data from.
.Ar cap
names one version of one file and carries an HMAC over it, under a key in
.Li state
that never leaves the database; only a file page contains one, and a cap
that does not verify is answered 403.
It does not expire, and is the same every time for the same version.
.Pp
.Pa /pdf
is the document the viewer opens: the reader's notes on that version if
there are any, otherwise the upstream bytes, with the headers of
.Pa /inline .
POST
.Pa /notes
replaces the notes on that version with the request body, which must be a PDF
no larger than
.Fl -max-file-size ;
the viewer's save shim sends it, and it answers 204 or the refusal as text.
POST
.Pa /position
replaces where the reader is in that version with the request body,
.Ql page= Ns Ar n Ns Li &top= Ns Ar y ,
and nothing else; the viewer's position shim sends it, and it answers likewise.
.Pp
All three carry
.Li "Access-Control-Allow-Origin: *" ,
because the frame is an opaque origin that could not read them otherwise,
.Li Access-Control-Expose-Headers
naming
.Li Accept-Ranges
and
.Li Content-Range ,
without which the viewer cannot see that it may fetch ranges and downloads the
whole document first, and
.Li "Referrer-Policy: no-referrer" ,
so that a link followed out of a PDF does not take the cap along.
They are never shown, linked or bookmarked; every address a reader sees is one
of the routes above.
See
.Sx WHERE IT LISTENS
in
.Xr campusweb 7
for why the frame is authorised by its address.
.It Pa /static/pdfjs/ Ns Ar path
One file of the stored viewer, revalidated by an ETag of its generation.
404 until a viewer has been stored.
.It Pa /news/ Ns Ar id
One news item.
.It Pa /messages
Stud.IP messages, newest first;
.Li ?box=outbox
for sent ones.
.It Pa /msg/ Ns Ar id
One message.
.It Pa /discussion/ Ns Ar id
A forum discussion with all its postings, oldest first.
.It Pa /posting/ Ns Ar id
Redirects to the posting within its discussion.
.It Pa /page/ Ns Ar id
One wiki or information page: its newest text, the versions
.Nm
has stored, and the other pages of the same kind in the course.
.Li ?version= Ns Ar n
shows the text of version
.Ar n ;
.Li ?diff= Ns Ar n
shows what version
.Ar n
changed against the one before it, line by line, above its text.
A change of a page on
.Pa /
links here, to its diff.
.It Pa /dates
Course dates from today to fourteen days ahead, or
.Li ?since=
to
.Li ?until= ,
each with the claims about it, and the dates only a claim names; see
.Sx CLAIMS .
.It Pa /source/ Ns Ar kind Ns / Ns Ar id
The text of a source claims cite, numbered by line as they cite it, with
the claims citing it;
.Ar kind
is
.Li file ,
.Li derived ,
.Li page ,
.Li news ,
.Li message ,
.Li course
or
.Li url ,
and
.Li ?version= Ns Ar n
picks a version of a file or page.
Line
.Ar n
is at
.Li # Ns Li L Ns Ar n .
.It Li POST Pa /file/ Ns Ar id Ns Pa /version/ Ns Ar n Ns Pa /derived
Store the request body as a derived version of version
.Ar n ,
with
.Li ?recipe= ,
.Li ?by=
and optionally
.Li ?name= ;
see
.Sx DERIVED VERSIONS .
.It Pa /derived/ Ns Ar k
Derivation
.Ar k Ns 's
bytes: text as text, a PDF inline, an image as an image, anything else, and
anything with
.Li ?download=1 ,
as an attachment.
.It Pa /derived/ Ns Ar k Ns Pa /text
The text
.Nm
reads out of it, as claims cite it: a text file as it is.
.It Li POST Pa /derived/ Ns Ar k Ns Pa /withdraw
Withdraw it; it stays readable, marked.
.It Li POST Pa /course/ Ns Ar id Ns Pa /own
Add the request body to the course as a new own file, with
.Li ?name= ,
.Li ?origin= ,
.Li ?by=
and optionally
.Li ?description= ;
answers its address,
.Pa /file/own- Ns Ar n .
See
.Sx OWN FILES .
.It Li POST Pa /file/own- Ns Ar n Ns Pa /version
Store the request body as the next version of own file
.Ar n ,
with
.Li ?origin=
and
.Li ?by= .
Refused for a file from Stud.IP.
.It Li POST Pa /file/own- Ns Ar n Ns Pa /withdraw
Withdraw own file
.Ar n ;
it stays readable, marked.
.It Li POST Pa /course/ Ns Ar id Ns Pa /claims
Add claims about the course's dates or the course, as JSON; see
.Sx CLAIMS .
.It Li POST Pa /claim/ Ns Ar n Ns Pa /withdraw
Withdraw claim
.Ar n .
.It Pa /status
The session, its history, the last sync runs, and what the mirror holds.
.It Pa /login
GET shows how to get the cookie;
POST with the form field
.Li cookie
checks and stores it.
.It Li POST Pa /sync
Queue a full run now.
.It Li POST Pa /seen
Mark changes seen: those of one course with
.Li course= Ns Ar id ,
or all of them under
.Li semester=
with
.Li all=1 ,
in either case only up to the change
.Li before= Ns Ar n ,
the newest one the page with the form showed.
Redirects to
.Li back= ,
a path on this site, or answers how many were marked as text.
.El
.Pp
Every
.Li POST
refuses a request whose
.Li Sec-Fetch-Site
or
.Li Origin
names another site, so a web page cannot swap the session for one of its own.
.Pp
Rich text from Stud.IP \(en news, postings, messages, descriptions, wiki and
information pages, which it stores as HTML \(en is never passed through as
markup.
The HTML rendering keeps its paragraphs, headings, lists, tables, emphasis and
links, rebuilt by
.Nm
from an allowlist, as described for pages in
.Sx PAGES ;
the text rendering shows it as text.
So is the text of a Word document, and a presentation's slides; see
.Sx WORD DOCUMENTS
and
.Sx PRESENTATIONS .
.Sh PAGES
A course can have two kinds of page that are a name and a text, edited in
place:
.Bl -tag -width Ds
.It the wiki
read from the JSON:API, every page with its whole text, on every run that
syncs the course;
.It information pages
Stud.IP's
.Dq freie Informationsseiten ,
a tab whose name the lecturer chooses
.Pq Dq Infos , Dq Teilnahme und Pr\(:ufung
with one or more entries.
They are in no API and are read from the website, one request per entry, at
most once a day per course; see
.Sx CAVEATS .
.El
.Pp
Since the text is overwritten upstream \(en the next person to sign up in a
wiki list replaces the list \(en every distinct text
.Nm
sees is kept as a version, numbered from 1, and a page removed upstream stays
readable here, marked.
What a version records is the text when
.Nm
looked, not every edit: two edits between two looks are one version, and an
information page changed and changed back within a day is none.
.Pp
In a browser a page's text keeps its structure, since a sign-up list is
usually a table; so does every other rich text, a news item's or a posting's.
Its markup is parsed and written out again element by element, keeping
paragraphs, line breaks, headings, lists, tables with their cell spans, bold,
italic, underline, strike-through, code, quotes and links, and nothing else:
no attribute but a link's target, a cell's span, a list's start and a text
colour; no other styles, no fonts, sizes, backgrounds, classes, scripts,
frames or forms.
A colour is kept as the three numbers it names; one near black or white, which
the editor writes for ordinary text, is dropped, so that the text follows the
light or dark scheme.
A link is made absolute against
.Fl -base-url
and kept only if it is http, https or mailto; it opens in a new tab.
An image is not loaded but becomes a link to it, named by its alt text.
The text rendering shows a page as text, as all rich text.
.Pp
A diff compares the text rendering of two versions, not Stud.IP's HTML:
lines, which are what paragraphs become.
A change only to markup, a re-saved page whose text is the same, is a version
with an empty diff.
.Pp
The first look at a course's pages is the backlog and is recorded seen, as
for everything in a course's first sync; that holds also for a course the
mirror had before it read pages.
.Sh WORD DOCUMENTS
A file whose type or name says .docx is read by
.Nm
when its bytes are stored, and its text shown on its page: paragraphs,
headings, numbered and bulleted lists numbered as Word numbers them, tables
with their merged cells, bold, italic, underline, strike-through, super- and
subscript, text colour, links, images, and footnotes and endnotes at the end.
The HTML is written by
.Nm
from the same allowlist as a page's, see
.Sx PAGES ;
the text rendering writes headings as
.Sq # ,
lists with their numbers, a table row as
.Sq Li "\&| a \&| b \&|" ,
a link as its text followed by
.Sq < Ns Ar url Ns > ,
an image as
.Sq Li \&[image Ar k : description Ns Li \&]
with its address listed above the text, and a footnote as
.Sq Li \&[ Ns Ar n Ns Li \&] .
Fonts, sizes, spacing, page layout and borders are not kept.
.Pp
An image in the document is shown where it is anchored, at the size the
document gives it but never wider than the text, if its bytes are PNG, JPEG
or GIF; it comes out of the document's own bytes, and nothing is fetched to
show it.
.Pp
What the text cannot show is named above it, in both renderings, with a link
to the original:
.Bl -tag -width Ds
.It image in a format browsers do not show: Ar ext
Such as EMF or WMF, which Word writes for drawings pasted from other
programs; left out, a bracketed marker with the description Word gave it
stands in its place.
So for
.Dq image that cannot be read ,
.Dq image too large to show ,
.Dq image missing from the file
and
.Dq image without its picture .
.It linked image, not loaded
An image the document links to on the web rather than contains.
It is not fetched: that would tell its host who reads the document, and when.
.It image shown uncropped
Cropped in Word; shown whole.
.It chart, diagram (SmartArt), drawing or shape
Left out, marked.
.It text box
Its text is put in a bracketed marker where it is anchored, which is not
necessarily where it appears on the page.
.It tracked change
Inserted text is shown, deleted text is not, neither marked as such.
.It comment
Not shown.
.It formula
Shown as the bare characters it is made of.
.It embedded object, embedded document (altChunk), symbol-font character
Left out, marked.
.It text in a header or footer
Not shown; the finding quotes its beginning.
.It hidden text
Not shown, as Word does not show it by default.
.It multi-column layout, table inside a table, content control
Shown, but the arrangement is lost.
.It unrecognised Ar element
An element of the document format that
.Nm
does not know.
Its text is shown, whatever it was meant to do is not.
.It not a readable Word document
The bytes are not a .docx \(en an old .doc, a damaged file \(en and no text is
shown.
.El
.Pp
A document with no finding has nothing in it but text in the structures
above; its layout may still differ.
.Pa /status
lists every stored Word document or presentation whose newest version has a
finding.
.Pp
The conversion is stored with the bytes, in the same transaction, and pages
only read it; see
.Sx FILES .
It belongs to the content, so the same bytes are converted once, wherever
they are uploaded.
When
.Nm
opens the database it converts, before it serves anything, every stored
document that has no conversion or one made by an older version of the
converter, and logs how many; after an upgrade that improves the converter,
the first start takes as long as that takes, about two hundredths of a second
a worksheet.
Should a page meet a conversion that is missing anyway, it converts the bytes
on the spot without storing anything, and shows the images as missing with a
finding that says to restart.
.Sh PRESENTATIONS
A file whose name ends in .pptx, or whose type says it is a PowerPoint
presentation, is converted like a Word document, when its bytes are stored,
and shown on its page as its slides, in the order of the presentation:
.Bl -bullet
.It
each slide a box of the slide's proportions, with every shape at its place
and size, turned and mirrored as in the file;
.It
the shapes of the slide's layout and master \(en a coloured bar, a line under
the title \(en drawn behind it, unless the layout says not to; their
placeholders lend the slide's text its position and style, and their prompt
text
.Pq Dq Mastertitelformat bearbeiten
is never shown;
.It
a shape's outline, preset or drawn freehand, with its fill and line colour,
and arrowheads on a line;
.It
text with its size, bold, italic, underline, strike-through, super- and
subscript, colour, alignment, indentation and links, and bullets and numbers
as on the slide;
.It
pictures, cropped as in the file, if their bytes are PNG, JPEG, GIF or WebP,
or SVG for a picture the file has in no other format \(en a logo, usually \(en
which is shown as an image, never put into the page;
.It
tables, with merged cells;
.It
the speaker notes, as text under the slide.
.El
.Pp
Lengths are relative to the slide's width, so a slide keeps its proportions
at any width of the window.
The slide keeps its own colours, a white slide stays white in the dark scheme,
and fonts are the browser's: text may wrap where it did not on the slide, and
take more room.
A box of text that needs more room than it had grows downwards, and the slide
grows with it rather than letting the text run off its bottom edge or over
what is below; a slide may so be taller than its proportions.
Pictures and shapes without text stay where they are.
The result is a faithful picture of where things are and what they say, not
a copy of the slide.
.Pp
The text rendering writes each slide as
.Sq Li "## Slide" Ar n Ns Li \&: Ar title ,
then the text of its shapes in the order of the file, bullets as
.Sq - ,
numbers as on the slide, a table row as
.Sq Li "\&| a \&| b \&|" ,
a picture as
.Sq Li \&[image Ar k : description Ns Li \&]
with its address listed above the text, and the speaker notes after it under
.Sq Li Notes\&: .
Slide numbers, dates and footers are on the slide but not in the text.
.Pp
What the view leaves out or approximates is named above it, as for a Word
document:
.Bl -tag -width Ds
.It hidden slide (not shown)
A slide the presentation hides when it is shown.
.It gradient shown as one colour
A gradient fill, of a shape, a background or text, shown as its first colour.
.It pattern fill not shown
The shape is drawn without its fill.
A picture as a shape's fill is shown, stretched over the shape's box.
.It image in a format browsers do not show: Ar ext
Such as EMF; left out, marked.
.It unknown shape geometry: Ar name
A shape whose outline
.Nm
cannot draw; its text is shown.
.It chart, diagram (SmartArt), embedded object, drawing or shape
Left out, marked where they are.
.It video or audio (not shown), ink (not shown)
The poster frame of a video is shown, if it is a picture.
.It formula
Left out, marked.
.It linked image, not loaded, image missing from the file, image without its picture, image shown uncropped
As for a Word document.
.It unrecognised Ar element
An element on a slide that
.Nm
does not know.
.It rotated group shown unrotated
Its shapes are where they would be if it were not turned.
.It text without a position (not shown)
A placeholder that neither the slide nor its layout or master places.
.It comments (not shown)
.It not a readable presentation
The bytes are not a .pptx \(en an old .ppt, a damaged file.
.El
.Pp
What a layout or master leaves out is the same on every slide that uses it and
is named once.
Effects \(en shadows, glow, 3-D \(en, animations and transitions are not shown
and not named: they change how a slide looks, not what it says.
.Sh DERIVED VERSIONS
A derived version is a file made from one version of a course file, outside
.Nm :
the text
.Xr pdftotext 1
reads out of a lecturer's PDF, an EPUB made from the scan of a book excerpt, a
copy of a scan with OCR.
It is uploaded with the program that made it and who ran it, and kept beside
the file, never instead of it:
.Bd -literal -offset indent
$ pdftotext -layout plan.pdf - | curl -s --data-binary @- \e
    'localhost:8780/file/<id>/version/2/derived?recipe=pdftotext+-layout+(poppler+25.10)&by=philip'
.Ed
.Pp
.Li recipe
says what made it, as exactly as the uploader cares to say;
.Li by
says who uploaded it.
Both are one line, required, and what
.Nm
shows of where the derived version comes from.
.Nm
runs none of these programs and does not check the recipe: it records what it
was told, and every page that shows a derived version says so.
.Pp
What it is is found from its bytes, never from a name:
.Bl -tag -width Ds
.It Li text
UTF-8 without NUL bytes.
Shown on the file page, line by line and numbered, in both renderings, and
citable by claims.
Form feeds, which
.Xr pdftotext 1
writes between pages, become empty lines.
.It Li epub
A zip whose
.Pa mimetype
entry says
.Li application/epub+zip ,
and whose package and chapters can be read; anything else claiming to be an
EPUB is refused.
It is served as an attachment, and its text is neither shown nor citable:
read as plain text, the markup that says which words could not be confirmed
\(en how
.Xr epubify 1
marks them \(en is lost, and an unconfirmed word would look like any other.
.It Li pdf
Served inline, for the browser's viewer.
.It Li image
PNG, JPEG, GIF or WebP, served as an image.
.It Li other
Served as an attachment.
.El
.Pp
A derived version belongs to the file version it was made from, as notes do;
a new version upstream starts without one.
The same recipe uploaded again for the same version withdraws the earlier
upload, which stays readable, marked, and names its successor; the same bytes
again are not stored twice.
Different recipes live side by side.
A file page shows the text of the newest derived version of the version shown,
or
.Li ?derived= Ns Ar k ;
when the same recipe was also run on the version before, what changed between
the two texts is shown above it, as for a page.
.Pp
Nothing about a derived version enters the feed or
.Sx SEEN :
it is the reader's, like notes.
.Sh OWN FILES
A seminar plan names a dozen texts, and the course has PDFs of three.
The rest are in a reader not yet uploaded, on a library shelf, or behind a
publisher's login, and the reader gets them by scanning a chapter at the
library, saving it from an e-book platform, or writing it themselves.
An own file is such a file, added to the course here rather than on
Digicampus:
.Bd -literal -offset indent
$ curl -s --data-binary @greber.pdf \e
    'localhost:8780/course/<id>/own?name=Greber+-+Oppositionen.pdf&by=philip&origin=Scan+UB+Augsburg+60/EC+1600+B745(3),+S.+193-210'
/file/own-3
.Ed
.Pp
.Li name
is the file's name, as a Stud.IP file has one;
.Li origin
says where the bytes come from \(en a scan and of what, a publisher's
platform and its address, or
.Dq selbst geschrieben
\(en as exactly as the uploader cares to say;
.Li by
says who added it.
All three are one line and required;
.Li description
is optional, as on Digicampus.
.Nm
checks none of them, as it does not check a derived version's recipe, and
every page that shows an own file says that it is not from Stud.IP and who
says where it came from.
.Pp
Beyond that, an own file is a file of the course like any other.
Its address is
.Pa /file/own- Ns Ar n ,
and its page has what a Stud.IP file's has: the PDF viewer and the reader's
notes on it, a Word document's text or a presentation's slides, its versions,
and its derived versions, so that
.Xr epubify 1
converts a scanned chapter from its address, and the EPUB is uploaded beside
it as for any other file.
It is a source a claim can cite, and a file a claim can be about, so that a
session's reading on
.Pa /dates
links to the scan of it; see
.Sx CLAIMS .
.Pp
An own file is not put in a folder.
The course page lists the own files in a section of their own,
.Dq Own files ,
after the folder tree, which stays what Digicampus has.
Where an own file belongs to a session, a claim says so.
.Pp
A better scan of the same pages is a new version, posted to
.Pa /file/own- Ns Ar n Ns Pa /version
with its own
.Li origin
and
.Li by ;
the old version stays, with its notes and derived versions, as an upstream
version does.
An own file that should not have been added is withdrawn, not deleted: it
stays readable and marked, and claims citing it or about it say so.
.Pp
Sync never touches an own file: Stud.IP not listing it is not its removal.
Own files enter neither the feed nor
.Sx SEEN ;
they are the reader's, like notes.
Like everything else here they do not go upstream.
.Sh CLAIMS
Stud.IP knows when and where a session is.
What it is about, that it is called off after all, that this one week it is in
the library: that is in a seminar plan uploaded as a file, on an information
page, in a news item.
A claim is one such statement, recorded with where it was read: the file and
version, or the derived version, page version or news item; the lines; the
words there that say it; and who read it there.
.Pp
Claims are made outside
.Nm ,
by a person or an agent who read the source, and posted to the course:
.Bd -literal -offset indent
$ curl -s -H 'Content-Type: application/json' \e
    localhost:8780/course/<id>/claims -d '{
  "by": "claude",
  "source": {"kind": "derived", "id": "12"},
  "supersede": false,
  "claims": [
    {"date": "2026-10-23", "field": "topic", "value": "Lyrik der Frühaufklärung",
     "lines": "17-18", "quote": "Lyrik der Frühaufklärung (B. H. Brockes"},
    {"date": "2026-10-23", "field": "reading",
     "value": "Brockes: Irdisches Vergnügen in Gott, Bd. 1, S. 3–12",
     "lines": "18-19", "quote": "Irdisches Vergnügen in Gott"},
    {"date": "2026-10-30", "field": "cancelled",
     "value": "wegen einmaliger Parallelveranstaltung",
     "lines": "20", "quote": "entfällt wegen einmaliger Parallelveranstaltung"},
    {"field": "office-hours", "value": "mittwochs, 16.00–17.00 Uhr",
     "lines": "6", "quote": "Sprechstunde: mittwochs, 16.00–17.00 Uhr"}
  ]}'
.Ed
.Pp
.Li source
is one of
.Bl -tag -width Ds
.It Li file
A file whose text
.Nm
has: a Word document or a presentation, as converted, or a text file;
a Stud.IP file or an own file, see
.Sx OWN FILES .
.Li version
picks one, the newest by default.
A PDF has no text of its own here; upload a derived version and cite that.
.It Li derived
A derived version with text, by its number; it names its file version itself.
.It Li page
A wiki or information page, its text rendering, at
.Li version
or the newest.
.It Li news
A news item of the course.
.It Li message
A Stud.IP message received, by its id, its text as
.Pa /msg/ Ns Ar id
shows it.
Lecturers write to the course what they do not put anywhere else: that a
session is on Zoom after all, what it will cover, that the room may still be
used.
A message names no course, so which course its claims are about is the
claimer's word, and the source page says so; a sent message is refused, being
the reader's words, not the course's.
It has no versions; deleted on Digicampus, its claims are stale.
.It Li folder
A folder, by its id: its name, and its description on a second line.
Lecturers often name a folder per session, with its topic, and sometimes put
there alone that a session is online.
.It Li file-entry
A file's entry in its folder, by the file's id: its name, and its description
on a second line \(en not its text, which is
.Li file .
File names say what to read and what not
.Pq Dq LESEN S. 15-25: Polaschegg.pdf ,
and a claim from one is about that file, so its value links to it.
.Pp
Folders and files are renamed in place, and
.Nm
keeps no old names, so neither has versions.
They are cited by id, not by line in a listing: what happens elsewhere in the
course's folders does not concern the claim, nor does a rename that keeps the
quote.
One that loses it, or removal upstream, makes the claim stale.
The
.Li folders
source, all of a course's folder names as one text cited by line, is no longer
taken for new claims; those made from it are still shown.
.It Li course
The course's details page, by the course's id: each filled-in field as a
heading
.Pq Dq # Lernorganisation
followed by its text.
That is where a self-study course says when it opens, or a course what its
exam is.
It has no versions and is cited by line, so a claim whose quote has left it is
marked stale, one whose quote has moved is linked to where it is now, and the
quote must be in it only once, or it could not be found again.
.It Li url
A web page, given as
.Li url
and
.Li text ,
the page's text as the claimer copied it.
.Nm
fetches nothing: it keeps the text as a snapshot, with the address and who
copied it, checks the quotes against it, and shows it at
.Pa /source/url/ Ns Ar n
as a copy it did not make.
The same text of the same address is the same snapshot, so the next claim from
that copy can name it by
.Li id
instead.
A newer, different copy of the same address makes the claims from the older
one stale.
This is for what is on Digicampus but not in its API \(en a course's
.Dq Lernorganisation ,
say \(en and for anything else on the web.
.El
.Pp
A claim with a
.Li date
(YYYY-MM-DD, in
.Fl -timezone )
is about the course date on that day;
.Li time
(HH:MM) picks one of several.
Its
.Li field
is one of
.Bl -tag -width "cancelled" -compact
.It Li topic
what the session is about;
.It Li reading
a text to read for it, as the source cites it \(en author, title, pages \(en
one claim per text;
.It Li cancelled
that it does not take place, the value being the reason as the source gives it;
.It Li location
where it is;
.It Li time
when it is, as HH:MM-HH:MM;
.It Li note
anything else.
.El
A claim without a date is about the course, and its field is a lowercase key
of the claimer's choosing:
.Li exam ,
.Li office-hours ,
.Li literature .
.Pp
.Li file ,
optional, is the id of a file of the course the claim is about: the PDF of a
reading the plan names, uploaded by the lecturer or added as an own file.
The source is where the claim was read; the file is what it is about, and
that it is the text meant is the claimer's word, which
.Nm
does not check beyond the file being the course's.
Its value links to the file, marked
.Sy \(->
in the text rendering, and the file's page lists it.
It is stale if the file is removed upstream, or withdrawn if it is an own file;
a new version of the file does not change which text it is.
A claim from a
.Li file-entry
is about that file without saying so.
.Sy \[u2197]
still leads to the source, as for any claim: the name it was read from and the
quote.
.Pp
.Li quote
is required: the words of the source that say it.
.Nm
checks that they are in the source, in
.Li lines
.Pq Dq 18 No or Dq 17-18
if given, comparing white space as one space, so a phrase wrapped over two lines
is found.
That is the one part of a claim it can check; whether the value is what the
quote means is the claimer's.
A batch is stored whole or not at all, and the answer says, for each claim,
which date it was attached to.
The same claim again is not stored twice.
.Li supersede
withdraws, first, the course's claims from the same document, any version:
that is how a new reading of a new version of the plan replaces the old one.
.Pp
A claim about a day Stud.IP has no date on is kept and shown as a date of its
own, marked
.Dq not in Stud.IP :
a session the plan has and Stud.IP does not, or a typo in the plan.
.Pp
Every listing of dates \(en a course page,
.Pa /dates ,
the next seven days on
.Pa /
\(en shows a date's claims under it, topic and readings first, each as its
value and a
.Sy \[u2197]
linking to the cited lines on
.Pa /source/ .
The HTML puts the source, the quote and who made the claim in the link's
title.
A file page and a
.Pa /source/
page list the claims citing them each under the date it is about, and in
full: the source and lines, the quote, and who made it.
The text rendering shows the same as the HTML, one request apart in the same
place: it is how an agent checks a claim before acting on it.
Stud.IP's data is never replaced by a claim; where they disagree, both are
shown, and the claim is marked:
.Bl -tag -width Ds
.It Sy conflict
Stud.IP says otherwise: the date takes place though a claim cancels it, or
is in another room, or at another time.
.It Sy stale
The source has changed since: the file has a newer version, the page a newer
text, the derived version was withdrawn, the folders and files or the course's
details no longer contain the quote, a newer copy of the web page was
taken, or the source was removed upstream.
The claim is still shown; it was true of what it cites.
.It Sy moved
The date the claim was attached to is no longer on the day the source names,
or is gone.
.El
.Pp
These are worked out every time a page is shown, from the mirror as it is
then.
Why claims are cited and checked rather than parsed out of the plan, and
shown beside Stud.IP rather than over it, is in
.Sx PROVENANCE
in
.Xr campusweb 7 .
Claims enter neither the feed nor
.Sx SEEN ,
and are not sent anywhere.
.Sh ANNOTATIONS
pdf.js can highlight, draw, write text and place stamps and signatures on a
PDF.
On a file page, whatever is done in the viewer is saved to
.Nm
about one and a half seconds after the last click or keystroke in it, and the
viewer's toolbar says
.Dq notes saved
or
.Dq NOT SAVED ,
with the reason as its tooltip.
What is saved is the whole annotated document, as pdf.js's own Save button
would download it, and the next time the page is opened that is what the viewer
shows.
.Pp
Notes belong to the version they were made on.
One copy per version is kept, the latest save; the upstream bytes are never
touched, and the copy goes into
.Li blobs
beside them.
.Pp
When Stud.IP publishes a new version of an annotated file, the file page keeps
opening the old version with the notes, and says that a newer one exists.
The newer one opens without notes with
.Li ?version= ,
and annotating it starts a second, separate copy.
Nothing is carried from one version to the next.
.Pp
Where the reader is in a version is kept as well, with notes or without: a
second after scrolling stops, and when the page is left or its tab hidden, the
viewer reports the page at its top and how far down that page, and the next
time the file page opens that version, on any device, the viewer opens there,
fitted to the width as always.
The position is in the document's own units, so a narrower window or another
zoom opens on the same line.
Like the notes it belongs to its version, and a new version opens at its first
page.
pdf.js's own memory of positions, in the browser, is not kept: the frame has
no storage of its own
.Pq see Xr campusweb 7 .
.Pp
Notes and positions are not synced anywhere, and not shown on Digicampus.
.Sh SEEN
Every change on
.Pa /
is
.Em unseen
until the reader has seen it here, and the pages mark what is: the navigation
counts it, the feed puts it on top, the course list counts it per course, and
a course page marks the files, folders, news, dates, discussions and pages it
concerns.
.Pp
A change becomes seen when the reader opens, in a browser, the page that shows
what it is about:
.Pa /file/ Ns Ar id ,
.Pa /news/ Ns Ar id ,
.Pa /msg/ Ns Ar id ,
.Pa /discussion/ Ns Ar id
for its postings,
.Pa /page/ Ns Ar id ,
and
.Pa /course/ Ns Ar id
for its dates.
The page still marks what was new on that visit; the next one does not.
Or when the reader marks it with the forms on
.Pa /
and the course page, which are
.Li POST /seen .
.Pp
Reading the text rendering never marks anything: that is how agents and
scripts read the mirror, and their reading is not the reader's.
It shows the same marks, as
.Ql UNSEEN .
Nor does a request the browser makes on its own: a prefetch
.Pq Li Sec-Purpose ,
or a page elsewhere embedding the address
.Pq Li Sec-Fetch-Dest
other than
.Li document .
.Pp
Seen belongs to a change, not to an item.
A file seen at version 1 is unseen again when version 2 arrives, and so is a
discussion when a posting is added to it.
.Pp
What a course holds when it is first synced \(en when the mirror is new, or the
account has joined the course \(en is recorded, but as seen; likewise the
messages and site news of the first full run.
It is the backlog, not news.
A mirror made before seen-tracking existed starts with everything seen.
.Pp
None of this reaches Stud.IP, which keeps its own, separate idea of what is
new: see
.Sx CAVEATS .
.Sh SEMESTERS
A course in Stud.IP runs from a start semester to an end semester, or
indefinitely.
.Li ?semester=
selects the courses running in a semester, given by its id, by its title as
Stud.IP writes it
.Pq Li "WS 2026/27" ,
or
.Li all .
Without it, the current semester is meant.
.Pp
On
.Pa /
the filter applies to course changes; messages and site-wide news belong to no
course and are always listed.
.Pp
Nothing about semesters affects what is synced: every course the account is in
is mirrored, whichever semester it belongs to, and a course of a past
semester is still synced while the account is in it.
.Sh RUNNING ON A SERVER
To read the mirror from more than one device \(en a laptop and a phone \(en
.Nm
runs on a machine that is always on, behind nginx, and nginx lets nobody in
who has not logged in at
.Xr passkey-gate 1
first.
.Nm
itself is not told: it listens on a unix socket only nginx can open, and
sees the requests nginx lets through.
.Pp
The NixOS module beside the sources does all of it:
.Bd -literal -offset indent
imports = [ .../campusweb/nixos-module.nix ];
profpatsch.campusweb.enable = true;
profpatsch.campusweb.hostName = "campusweb.profpatsch.de";
.Ed
.Pp
It runs
.Nm
as the system user
.Li campusweb
with the database in
.Pa /var/lib/campusweb
and the socket in
.Pa /run/campusweb ,
whose group nginx is put in; runs a
.Xr passkey-gate 1
for the host; and gives nginx a vhost with a certificate from Let's Encrypt.
The name must resolve to the machine before the first deploy.
.Pp
In the vhost, every path asks the gate first, with three exceptions:
.Bl -tag -width Ds
.It Pa /.gate/
The gate's own login and passkey pages.
.It Pa /static/pdfjs/
The viewer's code: Mozilla's release and the shims, no data.
.It Pa /frame/
The viewer's document and notes, which
.Nm
authorises by the
.Ar cap
in the address.
.El
.Pp
The last two are what the PDF viewer fetches, from a sandboxed frame whose
requests carry no cookie, so no gate that recognises the reader by one could
let them through.
Every other address, including the ones the reader bookmarks, is behind the
gate, and so is any route added later.
nginx removes the
.Li Cookie
and
.Li Authorization
headers before a request reaches
.Nm ,
which needs neither.
.Pp
On legosi it is
.Lk https://campusweb.profpatsch.de .
The first passkey is enrolled with
.Ql passkey-gate-campusweb enroll ,
as root, which prints a link to open on the device; see
.Xr passkey-gate 1 .
For
.Xr curl 1
and the like,
.Ql passkey-gate-campusweb token create --name ...
prints a token to send as
.Ql Authorization: Bearer .
.Pp
A mirror is moved by copying the database while neither side runs, after
folding in its WAL:
.Bd -literal -offset indent
$ systemctl --user stop campusweb
$ sqlite3 ~/.local/state/campusweb/campusweb.db '.backup cw.db'
# systemctl stop campusweb             (on the server)
$ scp cw.db root@host:/var/lib/campusweb/campusweb.db
# chown campusweb: /var/lib/campusweb/campusweb.db
# systemctl start campusweb
.Ed
.Pp
systemd hands the state directory to the service's user, not the files in it,
hence the
.Xr chown 1 .
A machine that ran an earlier version of the module, with a dynamic user, has
the data in
.Pa /var/lib/private/campusweb
and a symlink to it at
.Pa /var/lib/campusweb ;
replace the symlink by the directory, with the service stopped, before
deploying.
.Pp
Only one copy may sync an account: two would each poll, and a pasted session
in one would not reach the other.
.Sh FILES
.Bl -tag -width Ds
.It Pa ~/.local/state/campusweb/campusweb.db
The mirror and the session.
Opened in WAL mode with one connection for writing and a read-only pool for the
pages.
File bytes are served through a read-only connection of their own per
request, which reads only the part of the blob a range asks for, through
SQLite's incremental blob I/O; while a download runs, it holds back the WAL
checkpoint behind it.
Its tables:
.Bl -tag -width Ds -compact
.It Li sessions
Every pasted session, its cookies, and when it was last answered and died.
.It Li semesters , courses , folders , files
As Stud.IP has them, plus when each was first seen and when it went; a course
also has when its first sync was over,
.Li baselined_at ,
when its wiki and its information pages were first read, and when the
information pages were last read,
.Li info_checked_at ,
and the fields of its details page Stud.IP gives besides the description:
.Li miscellaneous , audience , requirements , teaching_method , achievement ,
.Li credits .
.It Li blobs
File bytes, one row per content, by SHA-256.
.It Li file_versions
Which bytes a file had, numbered from 1, with the upstream
.Li chdate
they were fetched at.
.It Li news , news_ranges
News, and which courses
.Pq or Li studip
each is in.
.It Li messages , events , forum_discussions , forum_postings
.It Li pages , page_versions
Wiki and information pages, and every text each has had, numbered from 1.
.It Li users
Names for the user ids messages and news carry.
.It Li changes
The feed on
.Pa / ,
each with when the reader saw it,
.Li seen_at ,
or
.Dv NULL ,
and for a page the version the change made.
.It Li activities
Stud.IP's activity stream as read.
.It Li sync_runs
The last two thousand runs.
.It Li annotations
The reader's annotated copy of a file version, by its
.Li file_versions
number, and when it was saved.
.It Li positions
Where the reader last was in a file version: the page at the top of the
viewer and how far down it, in PDF units, and when.
See
.Sx ANNOTATIONS .
.It Li state
The activity cursor, the account the mirror belongs to, when the account's
messages and site news were first read
.Pq Li baselined ,
and the key the frame capabilities are made with.
.It Li renders , render_images
What
.Nm
made of a content to show it, by its SHA-256: a Word document's text, as
HTML and as text, its findings, and which version of the converter made it;
and the images of it, whose bytes are in
.Li blobs .
See
.Sx WORD DOCUMENTS .
.It Li derivations
Derived versions: the file and version each was made from, the recipe and
uploader as given, its kind and bytes, and when it was withdrawn and by which
derivation.
See
.Sx DERIVED VERSIONS .
.It Li snapshots
Web pages as claimers copied them: address, text, who and when.
See
.Sx CLAIMS .
.It Li claims
Claims: the course, the date each was attached to and the day the source
names, field, value, source down to the version and lines, the quote, who made
it and when it was withdrawn.
See
.Sx CLAIMS .
.It Li pdfjs_asset , pdfjs_head
The vendored pdf.js viewer, one row per file per generation, and which
generation is live.
The same tables, and the same code, as
.Xr mailweb 1 .
.El
.It Pa /var/lib/campusweb/campusweb.db
The same, when run by the NixOS module.
.It Pa campusweb.service
The systemd user unit, beside the sources, for running it on the workstation
on loopback.
.It Pa nixos-module.nix
The NixOS module, for running it on a server; see
.Sx RUNNING ON A SERVER .
.El
.Sh EXAMPLES
.Bd -literal -offset indent
$ curl -s -H 'Accept: text/llm' localhost:8780/?since=-7d
$ curl -s -H 'Accept: text/llm' 'localhost:8780/courses?semester=all'
$ curl -s -H 'Accept: text/llm' localhost:8780/dates
$ curl -s -H 'Accept: text/llm' 'localhost:8780/?unseen=1'
$ curl -s -o folien.pdf localhost:8780/file/<id>/content
.Ed
.Pp
Paste a session from the command line:
.Bd -literal -offset indent
$ curl -s -H 'Accept: text/llm' localhost:8780/login \e
    --data-urlencode 'cookie=Studip_Session=…'
.Ed
.Sh SEE ALSO
.Xr calweb 1 ,
.Xr mailweb 1 ,
.Xr passkey-gate 1 ,
.Xr campusweb 7
.Pp
Stud.IP JSON:API:
.Lk https://hilfe.studip.de/develop/Entwickler/JSONAPI
.Sh AUTHORS
.An Profpatsch Aq mail@profpatsch.de
.Sh CAVEATS
.Ss The session expires, and a person has to replace it
How long a pasted session lasts is not known yet;
.Pa /status
is measuring it.
Until somebody pastes a new one, nothing is synced, and every page says so
rather than showing the stale mirror as current.
.Ss Reading is not entirely without trace
Stud.IP counts downloads, so every file
.Nm
fetches counts once, and again for every new version.
Reading a forum discussion's postings marks them read in Stud.IP, which is why
they are only read when the discussion changed.
Information pages are read from the website, which records a visit to the
course's information tab, as opening it there would; once a day per course,
which is why they are read no more often.
Messages are read from the box listings, which do not mark them read; a message
read only here stays unread on Digicampus.
.Ss Seen here is not read on Digicampus, and the other way round
Digicampus marks what is new per course and tool since the last visit there,
and only a visit there changes it.
Reading here leaves those marks as they were, and reading there does not mark
anything seen here.
The forum is the exception that is worse: since fetching a discussion's
postings marks them read on Digicampus,
.Nm
syncing a discussion has the same effect as reading it there.
.Ss Not everything a course can have is mirrored
Courseware, Blubber, participant lists, and files in tools other than the
course's file area are not.
Of the wiki, only the current text of each page is read; Stud.IP's own history
of a page is not, so the versions here begin when
.Nm
first read it.
.Ss Information pages depend on the website's layout
They are read from the HTML Digicampus shows, by the menu entries
.Li nav_scm_ Ns Ar id
and the
.Li <article class=\(dqstudip\(dq>
holding the text.
If a Stud.IP update changes that layout, the course's last sync says so
.Pq Dq the website's layout has changed
and the pages already read stay as they were; nothing is marked removed.
What is stored is Stud.IP's rendering of the text, not the text as the
lecturer wrote it.
.Ss The change feed only knows what it saw
A file changed and changed back between two syncs is one change or none.
Something that existed before the first sync is listed as new on the day it
was first seen; its upstream date is used where Stud.IP gives one.
A course date that was already in the past when it changed is reported like
any other.
.Ss The PDF viewer is downloaded and executed unattended
With
.Fl -pdfjs-update
on, about 5MB of pdf.js is fetched from GitHub whenever Mozilla publishes a
release and run, unread, in a frame of a page that holds the mirror.
The frame is denied campusweb's origin, which is what makes this tolerable
rather than reckless; it is not the same as safe.
pdf.js has had a bug that ran script in the embedding origin
.Pq CVE-2024-4367 ,
and against that the opaque origin is the whole defence.
There is no signature check and no pinned hash.
.Ss Notes are saved shortly after the last change, not at once
Leaving the page within a second or two of the last stroke makes the browser
ask whether to leave; leaving anyway loses that stroke.
Once everything is saved it does not ask.
.Ss Saved notes are part of the document when it is opened again
pdf.js writes them into the PDF as ordinary annotations, and reopens them as
such.
Text and stamps can still be edited; drawings and highlights from an earlier
session can be deleted but are not always editable again, depending on the
pdf.js release.
.Ss Notes do not follow a file to its next version
See
.Sx ANNOTATIONS .
A new version with inserted or removed pages would put carried-over notes on
the wrong text without anybody noticing; the old version with its notes stays
one click away instead.
.Ss A derived version is only as true as its uploader
.Nm
records the recipe it is told and runs nothing; a text that says it is
.Dq pdftotext -layout
may have been typed by hand.
Whoever can reach
.Nm
can upload one and name anybody as its uploader, as they can paste a session.
.Ss An own file is only what its uploader says it is
An own file's origin is recorded as told; a PDF said to be a scan of pages
193\(en210 of one book may be anything.
Whoever can reach
.Nm
can add one to any course, under any name.
.Ss A web page is only what the claimer copied
A
.Li url
claim's quote is checked against the text the claimer sent, not against the
page.
Whether the page said that is the claimer's word, as the recipe of a derived
version is the uploader's; the snapshot keeps what was sent, so the word is
on record.
.Ss A message's course is the claimer's word
Stud.IP gives a message no course, only the title its subject begins with,
when the lecturer wrote to the course.
A
.Li message
claim may be posted to any course; that it is about that one is not checked.
.Ss A claim's quote is checked, its meaning is not
The quoted words are in the cited lines; that the value is what they say, and
that the date is the one they are about, is the claimer's reading.
A seminar plan that lists 08.12. where it means 11.12. gives a claim for a day
Stud.IP has no date on, which is shown as such rather than guessed.
.Ss No authentication
Anyone who can reach the listen address reads everything and can paste a
session of their own.
On loopback that is everyone with a shell on the machine; on a Tailscale
address it is every node the tailnet ACLs let reach it, shared and tagged
nodes included; on a unix socket, whoever is in its group.
That restriction is the whole protection, or, behind nginx, the gate in front
of it is.
.Pp
Behind the gate, the
.Pa /frame/
routes are not behind it.
A
.Ar cap
leaked from the page \(en pasted somewhere, read off a screen \(en reads that
one PDF version with its notes and replaces those notes and the position,
for as long as the
key in
.Li state
is the same.
Deleting
.Li annotation_key
from
.Li state
.Pq see Sx FILES
and restarting revokes every cap at once; open file pages have to be
reloaded.