0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00
Commit Graph

273 Commits

Author SHA1 Message Date
Trevor Buckner
94f478477d Add test for missing meta:theme tag 2025-02-13 16:20:50 -05:00
Trevor Buckner
d8d672fada Error message if chosen theme does not have "meta:theme" tag. 2025-02-13 15:51:06 -05:00
Trevor Buckner
c080e5b191 Add author to snippetBundle 2025-02-10 22:20:12 -05:00
David Bolack
74122d9057 Display name of write in theme next to write-in
Clear user's active ThemeBundle when an incomplete/broken/invalid writein.

Needs theming help.
2025-01-07 22:11:01 -06:00
David Bolack
9745daf6e2 Merge branch 'master' into writeinBrewTheme 2024-12-20 15:19:06 -06:00
Trevor Buckner
57467701d0 Fetch Google Brew if only stub requested but nothing found
/update/ requests only the stub for updating. But if no stub exists, we should fetch the full brew so we return *something*.
2024-12-18 23:00:01 -05:00
Trevor Buckner
5f14f656ef Logging 2024-12-18 17:23:38 -05:00
Trevor Buckner
6e8a0d7314 current user owns 0-author brew only if edit mode
Previous code was treating /share/ visits to google brews with no stub as visits by owner, thus using their own credentials to open the file instead of serviceaccount
2024-12-18 17:07:09 -05:00
Trevor Buckner
e61144beb8 Mark as owner if stub doesn't exist
Old Google Drive files without a stub have no author, so if no stub exists, consider the current user the owner.
2024-12-18 13:45:53 -05:00
Trevor Buckner
64b792c645 Fix case where no stub is found
When retrieving a Google Brew with no stub yet, if the user is not logged in or has expired credentials, we enter this error handler. However, the error message itself tries to send a list of authors.

If there was no stub, we crash here with a 500 error.

This adds conditional operator to any stub value so we can send the actual "not logged in" error in case of no stub.
2024-12-18 13:02:14 -05:00
Víctor Losada Hernández
99f2972079 fixes as asked 2024-12-14 23:34:12 +01:00
David Bolack
47d7c69d1b Merge branch 'master' into writeinBrewTheme 2024-12-10 23:20:48 -06:00
Trevor Buckner
9758797e2b If user is owner, fetch Google Brew with user auth
Fixes the case where a user can see a Google Brew under their account (`listBrew()` uses their personal auth) but can't actually delete it (`getBrew()`  only uses the serviceAccount). Occurs if a Google brew has lost its permissions somehow (set to "restricted", etc.) such that serviceAccount can no longer interact with it.
2024-12-08 23:42:14 -05:00
Trevor Buckner
74a7983757 Refactor and clean up "getBrew()"
Some redundant logic and sprawling formatting
2024-12-08 23:39:26 -05:00
David Bolack
73c68fd11c Functional first pass.
Needs:

 - [ ] opinions on UI placement
 - [ ] opinions on best choice for displaying a write-in based User Brew ( flip to writin box? Add to drop-down list? )
2024-11-27 21:35:29 -06:00
Trevor Buckner
fb9148ada5 Site runs and all tests pass 2024-11-20 16:21:35 -05:00
G.Ambatte
033b7fa44f Lint fix 2024-11-10 19:35:57 +13:00
G.Ambatte
bd26f02ddb Remove getBrew admin regex search 2024-11-10 19:23:42 +13:00
G.Ambatte
63f6f6d3c6 Fix new getBrew access type 2024-10-25 11:27:28 +13:00
G.Ambatte
948f03b5b8 Add admin access type to getBrew 2024-10-25 11:18:36 +13:00
Trevor Buckner
6d4b1843ae Fix missed lines from 3.15.2 branch 2024-10-12 00:10:43 -04:00
Trevor Buckner
ff9a75f6b6 Remove duplicate error logs for google drive update / new
Errors are now logged once in the central error handler in app.js
2024-09-26 19:00:07 -04:00
Víctor Losada Hernández
1517c00132 error logging to vault 2024-09-01 19:39:00 +02:00
G.Ambatte
00e113ff67 Move getCSS to homebrew.api.js 2024-08-13 22:02:54 +12:00
Trevor Buckner
79c22f383f Allow renderer and pagecount into stubs
At this point, only text and textbin contents are still in google drive. Which is the majority of the file still. Renderer and Pagecount may become useful for Vault page, and Renderer is needed for themes.
2024-07-31 18:13:31 -04:00
Trevor Buckner
1abced20d6 Do not fetch user themes if there is no user. 2024-07-31 16:53:34 -04:00
Trevor Buckner
8221579b6a Linting 2024-07-28 18:03:25 -04:00
Trevor Buckner
ee9f2c8c83 Remove unused CSS endpoints in favor of #3075
Now that we have a dedicated /theme/ route for the recursive theming, the CSS endpoint can be simpler for only getting the `style` of a single brew. #3075 already has this simpler version, but no testing, so I have copied this into a comment there for implementation when it is ready.
2024-07-28 17:53:25 -04:00
Trevor Buckner
8aa88a2e45 Add proper error popup when theme fails to load 2024-07-28 16:45:01 -04:00
Trevor Buckner
f2d933410e Add error handling for missing themes 2024-07-27 19:17:05 -04:00
Trevor Buckner
113f9b3fe3 No need to stringify Theme Bundle object 2024-07-27 02:00:38 -04:00
Trevor Buckner
8e7baca47d Fix tests 2024-07-23 17:40:32 -04:00
Trevor Buckner
27c52fc244 Fix loading CSS for Legacy 2024-07-23 17:11:48 -04:00
Trevor Buckner
6ae249a527 Lint 2024-07-22 02:46:26 -04:00
Trevor Buckner
c0123b96eb Support snippet compilation
Original handling of snippets only worked if the current selected theme was a staticTheme. This now fully merges all snippets through the theme chain no matter what the top-level theme is. So user themes built on 5ePHB can benefit from 5ePHB snippets too.

User input of user snippets will be a later PR, but merging them into static snippets is now supported.
2024-07-22 02:44:41 -04:00
Trevor Buckner
0448f15322 Classify user brews as V3 if they use V3
Each theme in the theme chain, including user brews, must use the same renderer. When moving to V4 or future versions, it will be important to distinguish which themes are compatible with each other
2024-07-19 00:05:45 -04:00
Trevor Buckner
af5434c9b7 cleanup 2024-07-15 16:45:55 -04:00
Trevor Buckner
484b0a6dff simplify getThemeBundle() by using just one loop
Also, removes need for special handling of the "first" theme.
2024-07-15 16:38:19 -04:00
Trevor Buckner
62c619de24 userThemes need not be nested inside a Brew object 2024-07-13 19:38:51 -04:00
Trevor Buckner
44c96aad04 spacing 2024-07-13 18:11:04 -04:00
Trevor Buckner
591cae0e8f more renaming engine to renderer 2024-07-13 18:08:00 -04:00
Trevor Buckner
c9b885f868 include theme as baseTheme when getting user brew themes
`baseTheme` for a user brew theme is just the `theme` value of that brew.
2024-07-13 18:01:50 -04:00
Trevor Buckner
47f912750b Extract getting userThemes from getBrew()
`getBrew()` should do one thing only; retrieve a brew. UI elements like the list of themes available to the user are not part of a brew.

Moved into the handers for the `/edit/` and `/new/` endpoints
2024-07-13 17:44:23 -04:00
Trevor Buckner
f29a5e346e Remove id parameter from getUsersBrewThemes
Filtering out the current brew can be done later as needed; certain situations may call for retrieving the whole list.
2024-07-13 17:35:19 -04:00
Trevor Buckner
ee381c91fe Simplify getUserBrewThemes function a bit 2024-07-13 17:26:38 -04:00
Trevor Buckner
5f8d46f1b6 Reuse splitTextStyleAndMetadata from helpers.js 2024-07-13 17:09:45 -04:00
David Bolack
ade819c70c A not so light rework.
This removes the existing endpoints and replaces them with /theme.

/theme/:id - return a theme bundle containing all styling from this USER theme and any parents.
/theme/:engine/:id - return a theme bundle containing all styling from this STATIC theme and any parents

The theme bundle returns a marshalled JSON object containing:
  styles - an array of strings representing the collected styles in loading order
  snippets - an array ( currently empty ) of collected snippets.

The various bits of theme rendering code for <style> an style <link> have been swapped out with an 'onDidMount' call that loads the thendpoint and appends a series of <style> blocks to the brewRender's head.

This loses some caching advantages, but probably won't matter in the long run.
2024-07-13 12:12:05 -05:00
Trevor Buckner
29c2274a19 Unify some variable naming 2024-07-10 18:54:45 -04:00
Trevor Buckner
a6f787ea8f Remove getBrewThemeParentCSS 2024-07-10 17:56:39 -04:00
Trevor Buckner
28446d3ae2 Comments for theme CSS endpoints 2024-07-10 14:21:23 -04:00