Content display, requests and Google Workspace (v1.9.5 to v1.9.11-content-display) #15
5 changed files with 14 additions and 10 deletions
|
|
@ -37,7 +37,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
|
|||
- Word import: Blog posts → Import from Word turns a .docx into an unpublished post (headings, paragraphs, lists, tables, links); nginx needs a block for `/api/admin/import/docx` with an 11m body limit: `docs/importing.md`.
|
||||
- Speed: nginx must gzip JS/CSS/JSON/SVG and speak HTTP/2; page HTML is `no-cache`; uploads get a `-640.webp` small copy made at upload and at boot: `docs/performance.md`.
|
||||
- Security headers: the API sends them (Hono `secureHeaders()`, plus a CSRF check on `/api` writes); nginx sends HSTS on everything and must pass `Host` and `X-Forwarded-For` to the API: `docs/security-headers.md`.
|
||||
- Request form (`/request`): files go to the "Requests" folder of a Google shared drive and new-request emails go out through Gmail, both via a service account (`server/src/googleService.js`). `driveUpload(folder, ...)` finds or makes the named folder in the shared drive, so other uses get their own folder. Tools → Media → Files uploads to "Blog" and shares each file as anyone-with-the-link (`server/src/routes/files.js`, migration 048); link fields with `files: true` pick from it ("Choose a file"), and link cards take its first-page preview. Needs a `/api/admin/files` nginx block (51m). Off until `GOOGLE_SERVICE_ACCOUNT` plus `GOOGLE_SHARED_DRIVE` (the bare id, not a URL) / `GOOGLE_MAIL_FROM` are set. Needs its own nginx block. Setup: `docs/google-drive-and-mail.md`.
|
||||
- Request form (`/request`): files go to the "Requests" folder of a Google shared drive and new-request emails go out through Gmail, both via a service account (`server/src/googleService.js`). `driveUpload(folder, ...)` finds or makes the named folder in the shared drive, so other uses get their own folder. Tools → Media → Files uploads to "Media" and shares each file as anyone-with-the-link (`server/src/routes/files.js`, migration 048); link fields with `files: true` pick from it ("Choose a file"), and link cards take its first-page preview. Needs a `/api/admin/files` nginx block (51m). Off until `GOOGLE_SERVICE_ACCOUNT` plus `GOOGLE_SHARED_DRIVE` (the bare id, not a URL) / `GOOGLE_MAIL_FROM` are set. Needs its own nginx block. Setup: `docs/google-drive-and-mail.md`.
|
||||
- Google sign-in for @nextgenerationofunity.org admin accounts: on when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are set on the service. Accounts made by admin-cli get in; with access groups set (Site settings → Access, plus `GOOGLE_DIRECTORY_AS`), anyone in one gets a Google-only account whose role follows the group, rechecked at sign-in, hourly and by Panel → Re-sync now (`server/src/accessGroups.js`); superadmins and admin-cli accounts are never changed by groups. Passwords still work. Setup: `docs/google-sign-in.md`.
|
||||
|
||||
## Git workflow
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
The site keeps files in one Google **shared drive**: the Request form
|
||||
(`/request`) puts what people send in its "Requests" folder, and files
|
||||
uploaded in Tools → Media → Files, for pages to link to, go in its
|
||||
"Blog" folder (see "Files for pages" below). New requests can be emailed to whoever is listed in
|
||||
"Media" folder (see "Files for pages" below). New requests can be emailed to whoever is listed in
|
||||
Panel → Site settings → Notices. Both go through one Google **service
|
||||
account** (`server/src/googleService.js`). Nothing here is needed for
|
||||
the rest of the site; until it's set up, the form takes no files and no
|
||||
|
|
@ -61,12 +61,16 @@ hand.
|
|||
| Folder | Used by | Set in |
|
||||
| --- | --- | --- |
|
||||
| `Requests` | Files sent with the Request form | `DRIVE_FOLDER` in `server/src/routes/requests.js` |
|
||||
| `Blog` | Files for pages to link to (Tools → Media → Files) | `FOLDER` in `server/src/routes/files.js` |
|
||||
| `Media` | Files for pages to link to (Tools → Media → Files) | `FOLDER` in `server/src/routes/files.js` |
|
||||
|
||||
A new use calls `driveUpload("<Folder>", name, mime, bytes)` from
|
||||
`server/src/googleService.js`; a path such as `"Blog/2026"` makes each
|
||||
`server/src/googleService.js`; a path such as `"Media/2026"` makes each
|
||||
level. Add it to this table.
|
||||
|
||||
Files for pages went in a folder called `Blog` before v1.9.10. If the
|
||||
shared drive has one, rename it to `Media` in Drive: the files inside
|
||||
keep working and stay listed, and nothing is made twice.
|
||||
|
||||
Folders are matched by name, so renaming or moving one in Drive makes
|
||||
the site start a new one under the old name (files already stored keep
|
||||
working: they're found by their own id). People can add their own
|
||||
|
|
@ -173,7 +177,7 @@ from it"), the same conversion as Blog posts → Import from Word
|
|||
## Files for pages
|
||||
|
||||
Tools → Media → **Files** (editors and up upload, admins and up delete)
|
||||
puts a file in the shared drive's `Blog` folder and shares it as
|
||||
puts a file in the shared drive's `Media` folder and shares it as
|
||||
**anyone with the link can view**, so visitors open it in Drive's viewer
|
||||
without signing in. Content block links pick from it with **Choose a
|
||||
file**: paragraph, button and image links, list and link-button items,
|
||||
|
|
@ -189,7 +193,7 @@ Drive" above the title.
|
|||
little after upload. The server asks at once and again over the next
|
||||
few minutes, and saves it into the image library as an ordinary
|
||||
upload. Audio and zips get an icon in the admin and no picture.
|
||||
- **Files put in the Blog folder in Drive itself** (dragged in, made
|
||||
- **Files put in the Media folder in Drive itself** (dragged in, made
|
||||
there, moved there) are listed too: opening the Files tab or a
|
||||
"Choose a file" picker looks in the folder (at most every 30
|
||||
seconds), adds anything new, shares it the same way and fetches its
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
its own), with a folder per use: "Requests" for files sent
|
||||
with the Request form, and so on. Each folder is found by
|
||||
name, or made, the first time it's needed; a path such as
|
||||
"Blog/2026" makes each level.
|
||||
"Media/2026" makes each level.
|
||||
Gmail new-request notices, sent as a Workspace user through
|
||||
domain-wide delegation.
|
||||
Groups who is in the admin access groups (accessGroups.js), read
|
||||
|
|
@ -121,7 +121,7 @@ const FOLDER = "application/vnd.google-apps.folder";
|
|||
const folders = new Map();
|
||||
|
||||
/* The id of a folder in the shared drive, eg. "Requests" or
|
||||
"Blog/2026", made if it isn't there. Found by name, so a folder
|
||||
"Media/2026", made if it isn't there. Found by name, so a folder
|
||||
renamed in Drive is made again under the old name. */
|
||||
export function driveFolder(path) {
|
||||
let pending = folders.get(path);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import { NO_STORE } from "../shape.js";
|
|||
const files = new Hono();
|
||||
files.use("*", requireAuth);
|
||||
|
||||
const FOLDER = "Blog";
|
||||
const FOLDER = "Media";
|
||||
const MAX_FILE_BYTES = 50 * 1024 * 1024;
|
||||
const MAX_LIST = 500;
|
||||
// Seconds after upload to ask Drive for the preview again.
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ export default function AdminMedia() {
|
|||
<p className="text-sm text-muted">
|
||||
{tab === "images"
|
||||
? "Uploaded images. Image fields in every editor pick from here."
|
||||
: "Files in the shared Google Drive's Blog folder, for pages to link to, including any put there in Drive itself. Link fields pick from here with Choose a file."}
|
||||
: "Files in the shared Google Drive's Media folder, for pages to link to, including any put there in Drive itself. Link fields pick from here with Choose a file."}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue