Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- **AllAboard reports** (v55, report script only). The report script can also file AllAboard's "Something not working?" reports: an issue in the AllAboard repository and an email to the same reports inbox. It is off until the `ALLABOARD_TOKEN` script property is set (see docs/REPORTS.md). Nothing changes for teachers using OverBoard.
- **PDFs open a little faster** (v54, PDF app). The PDF reader now gets ready while the start screen is up, instead of when you pick a file, and one reader is kept for every PDF you open, so Open again and adding a notebook page no longer start a new one each time. Checking which PDF it is (to find its ink) now happens while the PDF opens, not before.
- **Laser pointer sound** (v53, PDF app and HTML overlay). Turning on the laser pointer now plays a short, quiet, low laser sound, so it is clear what just happened. Turning it off is silent.
- **Laser pointer** (v52, PDF app and HTML overlay). Tap the pen or highlighter color you already have selected, and its ring turns black, red, black. What you draw now stays for two seconds after you lift the pen, then fades away by itself. It is never saved, printed or added to Undo. Tap the color again, or pick another color or tool, to go back to writing. Your palm still erases.
Expand Down
4 changes: 2 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OverBoard PDF</title>
<meta name="description" content="OverBoard: write on any PDF on your smartboard. Runs in the browser; nothing is uploaded.">
<meta name="ob-version" content="4831a1cabadf">
<meta name="ob-version" content="15090c822e13">
<meta name="theme-color" content="#145da0">
<link rel="manifest" href="manifest.json">
<link rel="icon" href="icons/favicon.ico" sizes="32x32">
Expand Down Expand Up @@ -47,7 +47,7 @@ <h2 data-t="open_again">Open again</h2>
<p class="note"><span data-th="start_note">Your PDF and your ink stay in this browser on this computer. Nothing is uploaded.
Have a Word file? In Word, choose File → Save as PDF, then drop the PDF here.
Have an HTML worksheet? Drop it here to get a <i>_board.html</i> copy you can write on.</span>
<br><a href="https://github.com/BPMData/OverBoard" data-t="about">About OverBoard</a> · <a href="report/?from=start" target="_blank" data-t="board_help">Board not working?</a> · <span id="ob-release" title="OverBoard version">v54</span></p>
<br><a href="https://github.com/BPMData/OverBoard" data-t="about">About OverBoard</a> · <a href="report/?from=start" target="_blank" data-t="board_help">Board not working?</a> · <span id="ob-release" title="OverBoard version">v55</span></p>
<p class="note ob-langpick"><label><span aria-hidden="true">🌐</span> <select id="ob-lang" aria-label="Language" data-ta="language" data-tt="language" title="Language"></select></label></p>
</div>
</main>
Expand Down
2 changes: 1 addition & 1 deletion app/report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h1 data-t="r_h1">Is OverBoard not working on your board?</h1>
<p data-th="r_intro2">If something doesn't work the way the page asks, that's fine. <b>That's exactly what I need to know.</b> Just keep going.</p>
<p class="mute small" data-th="r_privacy">Nothing is sent until you press <b>Send</b> at the very end, and you'll see everything first. No worksheets, PDFs or ink are ever included.</p>
<div class="row"><button class="go big" data-go="start" data-t="r_start">Start</button></div>
<p class="mute small" style="margin-top:28px">OverBoard <span id="ob-release" title="OverBoard version">v54</span></p>
<p class="mute small" style="margin-top:28px">OverBoard <span id="ob-release" title="OverBoard version">v55</span></p>
</div></div>
</section>

Expand Down
10 changes: 5 additions & 5 deletions app/sw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ===== GENERATED by tools/build.py: every file the app needs, with the start of its SHA-256. Do not edit by hand. =====
const VERSION = '911d716dff20';
const VERSION = 'a802f2e8d7cf';
const FILES = {
"../overlay/ink_overlay.html": "658c92c6773cccf9",
"../overlay/ink_overlay.html": "92230cd9904a53a0",
"../shared/ink-core.js": "b65c19035e241559",
"../shared/strings.js": "b247836e7165abf0",
"../shared/toolbar.css": "a611595b897560c5",
Expand All @@ -17,14 +17,14 @@ const FILES = {
"icons/icon-512.png": "46ca8bd2d6a32612",
"icons/maskable-512.png": "c7d41ed2fa4ad874",
"image.js": "d396b7d4f5aced4e",
"index.html": "9460c8776a417eb4",
"index.html": "360ec9956137d366",
"ink.js": "3dc693cb202efe0c",
"libs.js": "bedbbbc2c8495fdf",
"main.js": "e842901e26803484",
"manifest.json": "416c107c34c8610b",
"notebook.js": "7346e40dda6ff149",
"offline.js": "6504935b2738711a",
"report/index.html": "8885a58fbb345993",
"report/index.html": "b346bb2f11dfa1d2",
"store.js": "155ec064f6ffe569",
"textlayer.js": "383ad22e91afb648",
"vendor/pdf-lib@1.17.1/LICENSE.md": "f2c9fc00fdb66eb9",
Expand Down Expand Up @@ -217,7 +217,7 @@ const FILES = {
"vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-BoldItalic.ttf": "a224075ac17495ad",
"vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Italic.ttf": "832b4406dbef2362",
"vendor/pdfjs-dist@4.10.38/standard_fonts/LiberationSans-Regular.ttf": "f8ace1f892b2bd9d",
"version.json": "fe7d8c7110d62f35",
"version.json": "b35efdc4d68f7af2",
"viewer.js": "1cffd9d5c7158958"
};
// ===== END GENERATED =====
Expand Down
2 changes: 1 addition & 1 deletion app/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"v": "4831a1cabadf",
"v": "15090c822e13",
"js": [
"embed.js",
"export.js",
Expand Down
13 changes: 13 additions & 0 deletions docs/REPORTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ To check it's live: open the Web app URL in a browser. It should show `{"ok":tru

Edit the code, save, then **Deploy ▸ Manage deployments ▸ ✏️ (edit) ▸ Version: New version ▸ Deploy**. This keeps the same URL, so the page doesn't need to change. (A *New deployment* gets a new URL.)

## AllAboard reports (optional)

The same script also files AllAboard's **Something not working?** reports, so both apps share one inbox, one GitHub key and one deployment. AllAboard's server sends each report with a shared secret; the script opens an issue in the AllAboard repository (label `user-report`) and emails the private part to the reports inbox with `[AllAboard]` in the subject. No thank-you or follow-up emails for these. Without the steps below, the script turns AllAboard reports away and AllAboard shows its copy / download / email fallback.

1. **Let the key reach AllAboard.** On GitHub, open the `OverBoard reports` token ([fine-grained tokens](https://github.com/settings/personal-access-tokens)) ▸ **Edit** ▸ *Repository access* ▸ also tick **AllAboard** ▸ **Update**. Issues: *Read and write* already covers it. (Or make a separate AllAboard-only token and add it as the script property `ALLABOARD_GITHUB_TOKEN`.)
2. In the AllAboard repository, **Issues ▸ Labels ▸ New label** `user-report` (optional: without it, issues are opened unlabeled).
3. **Make a secret.** Any long random string, for example from `openssl rand -hex 32`. In the script's **Project Settings ▸ Script properties**, add `ALLABOARD_TOKEN` with that value.
4. Paste in the new `tools/report-relay.gs`, save, and run **checkSetup**. The log should say "AllAboard reports are on".
5. **Deploy ▸ Manage deployments ▸ ✏️ ▸ Version: New version ▸ Deploy** (same URL as before).
6. In the AllAboard repository, add two Actions secrets: `REPORT_RELAY_URL` (this script's Web app URL) and `REPORT_RELAY_TOKEN` (the same secret as `ALLABOARD_TOKEN`). The next AllAboard deploy picks them up.

AllAboard reports count toward the same 20-an-hour, 40-a-day limits.

## Good to know

- **Limits.** A gmail.com account can send about 100 emails a day, so the script keeps well under that even if a robot floods it: at most 20 reports an hour and 40 a day (more is turned away, and the page offers Download / Copy instead), at most 25 thank-you emails a day, and only one thank-you per email address a week. A teacher who sends a second report that week still gets the follow-up when it's fixed. The counts are kept in Script properties as `day:…` and `thanked:…` (a scrambled form of the address); the daily check deletes old ones. To change a limit, edit the numbers near the top of the script.
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h2>Exit ticket</h2>
<div class="lines"><div></div><div></div><div></div><div></div></div>
<div class="foot">OverBoard · page 2 / 2 · Your ink saves in this browser only. Nothing is uploaded.</div>
</div>
<!-- ===== INK OVERLAY START (v54) =====
<!-- ===== INK OVERLAY START (v55) =====
Smartboard writing layer. Paste this whole block just before </body> in any .html file.
SMART BOARD: pen tip writes. Palm, fist or side of hand erases (the board reports it as an eraser).
Finger (and the round end of the SMART pen) scrolls the page; the "Finger" button switches it to drawing if you lose the pen.
Expand Down
2 changes: 1 addition & 1 deletion overlay/ink_overlay.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- ===== INK OVERLAY START (v54) =====
<!-- ===== INK OVERLAY START (v55) =====
Smartboard writing layer. Paste this whole block just before </body> in any .html file.
SMART BOARD: pen tip writes. Palm, fist or side of hand erases (the board reports it as an eraser).
Finger (and the round end of the SMART pen) scrolls the page; the "Finger" button switches it to drawing if you lose the pen.
Expand Down
89 changes: 88 additions & 1 deletion tools/report-relay.gs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@
and the titles of the pull requests that fixed it; fixed text adds how to make sure OverBoard has the new version.
An issue closed as "not planned" (or a duplicate) sends nothing.

It also relays AllAboard's "Something not working?" reports (see allAboardReport below). Those come from the
AllAboard server, not a browser, carry a shared secret, and arrive with the issue and email already written. They
open an issue in the AllAboard repository and email the same inbox. No thank-you or follow-up emails for them.

Script properties (Project Settings ▸ Script properties):
GITHUB_TOKEN a fine-grained GitHub token: this repository only, Issues: read and write
GITHUB_TOKEN a fine-grained GitHub token: Issues: read and write on OverBoard (and AllAboard, for its reports)
GITHUB_REPO BPMData/OverBoard
ANTHROPIC_API_KEY (optional) for Claude Haiku's paragraph; without it the follow-up uses a plain fixed paragraph
NOTIFY_EMAIL (optional) where to email reports; leave it out to use this Google account's own inbox
ALLABOARD_TOKEN (optional) turns on AllAboard reports: a long random secret, the same value as AllAboard's
REPORT_RELAY_TOKEN GitHub secret. Without it, AllAboard reports are refused.
ALLABOARD_REPO (optional) default BPMData/AllAboard
ALLABOARD_GITHUB_TOKEN (optional) a separate token for AllAboard issues; without it GITHUB_TOKEN is used
*/

var MAX_CHARS = 300000; // a report is usually 20-60 KB; refuse anything far bigger
Expand All @@ -38,6 +46,7 @@ function doPost(e) {
var text = (e && e.postData && e.postData.contents) || '';
if (text.length > MAX_CHARS) return reply({ ok: false, error: 'too big' });
var r = JSON.parse(text);
if (r && r.app === 'AllAboard') return reply(allAboardReport(r));
if (!r || r.app !== 'OverBoard' || r.kind !== 'board-report') return reply({ ok: false, error: 'not a report' });
if (r.website) return reply({ ok: true }); // the hidden "leave this empty" box was filled in: a robot. Pretend it worked.
if (!underLimit()) return reply({ ok: false, error: 'busy' });
Expand Down Expand Up @@ -227,6 +236,74 @@ function emailReport(r, priv, issue, issueError, props) {
MailApp.sendEmail(opts);
}

/* ---------- AllAboard reports ---------- */
/* AllAboard's server (problemReportRoute.ts in BPMData/AllAboard) posts
{ app: 'AllAboard', kind: 'problem-report', token, issue: { title, body, labels }, email: { subject, body, replyTo? } }
The server has already removed anything private from the issue; contact details and comments are only in the email.
Counts toward the same hourly and daily limits as OverBoard reports, since both send from this one Gmail account. */
function allAboardReport(r) {
var props = PropertiesService.getScriptProperties();
var secret = props.getProperty('ALLABOARD_TOKEN');
if (!secret || r.kind !== 'problem-report' || !sameText(String(r.token || ''), secret)) return { ok: false, error: 'not allowed' };
var issueIn = r.issue || {}, mail = r.email || {};
if (typeof issueIn.title !== 'string' || typeof mail.subject !== 'string') return { ok: false, error: 'not a report' };
if (!underLimit()) return { ok: false, error: 'busy' };

var issue = null, issueError = '';
try {
issue = openAllAboardIssue(issueIn, props);
} catch (err) { issueError = String(err).slice(0, 500); }

var emailed = false;
try {
var to = props.getProperty('NOTIFY_EMAIL') || Session.getEffectiveUser().getEmail();
var replyTo = String(mail.replyTo || '').trim();
var opts = {
to: to, name: 'AllAboard reports',
subject: (String(mail.subject).slice(0, 180) + (issue ? ' (issue #' + issue.number + ')' : '')),
body: [
issue ? 'GitHub issue: ' + issue.html_url : 'The GitHub issue could not be made: ' + (issueError || 'unknown reason'),
EMAIL_RE.test(replyTo) ? 'Reply to this message to answer them.' : '',
'',
String(mail.body || '').slice(0, 20000),
].join('\n'),
};
if (EMAIL_RE.test(replyTo)) opts.replyTo = replyTo;
MailApp.sendEmail(opts);
emailed = true;
} catch (err) { Logger.log('AllAboard email failed: ' + err); }

if (!issue && !emailed) return { ok: false, error: 'could not deliver' };
return { ok: true, issue: issue ? issue.number : null, url: issue ? issue.html_url : null, emailed: emailed };
}

function openAllAboardIssue(issueIn, props) {
var token = props.getProperty('ALLABOARD_GITHUB_TOKEN') || props.getProperty('GITHUB_TOKEN');
var repo = props.getProperty('ALLABOARD_REPO') || 'BPMData/AllAboard';
if (!token) throw new Error('GITHUB_TOKEN is not set');
var labels = (issueIn.labels || []).slice(0, 5).map(function (l) { return String(l).slice(0, 50); });
function post(withLabels) {
return UrlFetchApp.fetch('https://api.github.com/repos/' + repo + '/issues', {
method: 'post', contentType: 'application/json', muteHttpExceptions: true,
headers: { Authorization: 'Bearer ' + token, Accept: 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28' },
payload: JSON.stringify({ title: String(issueIn.title).slice(0, 200), body: String(issueIn.body || '').slice(0, ISSUE_LIMIT),
labels: withLabels ? labels : [] }),
});
}
var res = post(true);
if (res.getResponseCode() === 422 && labels.length) res = post(false); // a label GitHub won't take: try without
if (res.getResponseCode() !== 201) throw new Error('GitHub said ' + res.getResponseCode() + ': ' + res.getContentText().slice(0, 300));
return JSON.parse(res.getContentText());
}

/* compares two secrets without stopping at the first difference */
function sameText(a, b) {
if (a.length !== b.length) return false;
var diff = 0;
for (var i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
return diff === 0;
}

/* ---------- emails to the teacher ---------- */
/* the two emails to the teacher, in the language they used on the report page (r.lang); {name} is filled in */
var LANG_NAMES = {"en": "English", "es": "Spanish", "zh": "Simplified Chinese (Mandarin)", "tl": "Tagalog (Filipino)", "vi": "Vietnamese", "fr": "French", "pt": "Brazilian Portuguese", "ar": "Arabic"};
Expand Down Expand Up @@ -471,4 +548,14 @@ function checkSetup() {
MailApp.sendEmail(to, 'OverBoard relay: setup check', 'If you can read this, the relay can email you. Next: Deploy ▸ New deployment (see docs/REPORTS.md).');
Logger.log('Sent a test email to ' + to + '. All set.');
if (!props.getProperty('ANTHROPIC_API_KEY')) Logger.log('No ANTHROPIC_API_KEY: follow-up emails will use the plain fixed paragraph.');
if (props.getProperty('ALLABOARD_TOKEN')) {
var aaRepo = props.getProperty('ALLABOARD_REPO') || 'BPMData/AllAboard';
var aaToken = props.getProperty('ALLABOARD_GITHUB_TOKEN') || token;
var aa = UrlFetchApp.fetch('https://api.github.com/repos/' + aaRepo, { muteHttpExceptions: true,
headers: { Authorization: 'Bearer ' + aaToken, Accept: 'application/vnd.github+json' } });
if (aa.getResponseCode() !== 200) throw new Error('AllAboard reports are on, but the token can\'t reach ' + aaRepo + ' (' + aa.getResponseCode() + '). Add ' + aaRepo + ' to the token\'s repositories.');
Logger.log('AllAboard reports are on: issues go to ' + aaRepo + '.');
} else {
Logger.log('No ALLABOARD_TOKEN: AllAboard reports are off.');
}
}
Loading