Add a file library in Google Drive for pages to link to
Tools → Media → Files uploads PDF, Office (.docx, .xlsx, .pptx), MP3, M4A and zip files, up to 50 MB, to the shared drive's Blog folder and shares each as anyone with the link can view (migration 048). A file's name and contents must agree. Content block links get "Choose a file" (paragraph, button and image links, list and link items, link cards). A link card also takes the file's name and Drive's picture of its first page, fetched after upload and saved into the image library; cards to Drive say "Google Drive". Deleting a file says first what still links to it. Setup and the nginx block: docs/google-drive-and-mail.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
36c9226bd9
commit
934598f954
13 changed files with 772 additions and 33 deletions
|
|
@ -1,9 +1,9 @@
|
|||
# Google Drive and Gmail (the Request form)
|
||||
# Google Drive and Gmail
|
||||
|
||||
The site keeps files in one Google **shared drive**: the Request form
|
||||
(`/request`) puts what people send in its "Requests" folder, and later
|
||||
uses (eg. files linked from blog posts) get folders of their own. New
|
||||
requests can be emailed to whoever is listed in
|
||||
(`/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
|
||||
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,6 +61,7 @@ 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` |
|
||||
|
||||
A new use calls `driveUpload("<Folder>", name, mime, bytes)` from
|
||||
`server/src/googleService.js`; a path such as `"Blog/2026"` makes each
|
||||
|
|
@ -129,6 +130,14 @@ location = /api/requests {
|
|||
proxy_read_timeout 120s;
|
||||
client_max_body_size 31m;
|
||||
}
|
||||
|
||||
# Tools → Media → Files: one file of up to 50 MB
|
||||
location = /api/admin/files {
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
# the usual proxy_set_header lines
|
||||
proxy_read_timeout 180s;
|
||||
client_max_body_size 51m;
|
||||
}
|
||||
```
|
||||
|
||||
`sudo nginx -t && sudo systemctl reload nginx && sudo systemctl restart ngu-api`.
|
||||
|
|
@ -160,3 +169,43 @@ checked by their contents rather than their names
|
|||
turned into an unpublished blog post from the queue ("Make a blog post
|
||||
from it"), the same conversion as Blog posts → Import from Word
|
||||
(`docs/importing.md`).
|
||||
|
||||
## 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
|
||||
**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,
|
||||
and link cards. A link card also takes the file's name as its title and
|
||||
Drive's picture of the first page as its picture; the card says "Google
|
||||
Drive" above the title.
|
||||
|
||||
- Types: PDF, Word, Excel and PowerPoint (.docx, .xlsx, .pptx), MP3,
|
||||
M4A and zip, up to 50 MB. The name and the contents must agree (a PDF
|
||||
named `.mp3` is refused). Older Office formats (.doc, .ppt) aren't
|
||||
taken: save them in the new format first.
|
||||
- The first-page picture: Drive draws one for PDFs and Office files a
|
||||
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.
|
||||
- Deleting a file in the admin deletes it from Drive; the delete says
|
||||
first which records still link to it (those links stop working).
|
||||
Deleting it in Drive by hand leaves a broken link and a list entry
|
||||
that can still be deleted.
|
||||
|
||||
**Sharing has to be allowed.** Uploads fail with "Drive wouldn't share
|
||||
it with anyone who has the link" unless both allow it:
|
||||
|
||||
1. Admin console → Apps → Google Workspace → Drive and Docs → Sharing
|
||||
settings: sharing outside nextgenerationofunity.org is on (at least
|
||||
for the organizational unit the service account's delegated user is
|
||||
in, and for shared drives: "Allow people outside ... to access files
|
||||
in shared drives").
|
||||
2. The shared drive itself → Shared drive settings: "Allow people who
|
||||
aren't shared drive members to access files" and sharing outside the
|
||||
organization are on.
|
||||
|
||||
Files the Request form stores are never shared this way; only files
|
||||
uploaded in Tools → Media → Files are.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue