-
Notifications
You must be signed in to change notification settings - Fork 204
Drawing Gallery #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bios-Marcel
wants to merge
5
commits into
master
Choose a base branch
from
gallery_v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Drawing Gallery #395
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
24c8c41
Rewrite old gallery branch, attempt 2
Bios-Marcel a8360c3
solve fixmes
Bios-Marcel d876b10
drawings now stored per lobby and refresh when new drawings get in
Bios-Marcel 3f2177e
remove templating for gallery JS
Bios-Marcel 5e27d5c
Improve gallery
Bios-Marcel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package frontend | ||
|
|
||
| import ( | ||
| "log" | ||
| "net/http" | ||
| "strings" | ||
|
|
||
| "github.com/scribble-rs/scribble.rs/internal/api" | ||
| "github.com/scribble-rs/scribble.rs/internal/translations" | ||
| ) | ||
|
|
||
| type galleryPageData struct { | ||
| *BasePageConfig | ||
|
|
||
| LobbyID string | ||
| Translation *translations.Translation | ||
| Locale string | ||
| } | ||
|
|
||
| func (handler *SSRHandler) ssrGallery(writer http.ResponseWriter, request *http.Request) { | ||
| userAgent := strings.ToLower(request.UserAgent()) | ||
| if !isHumanAgent(userAgent) { | ||
| translation, _ := determineTranslation(request) | ||
| writer.WriteHeader(http.StatusForbidden) | ||
| handler.userFacingError(writer, translation.Get("forbidden"), translation) | ||
| return | ||
| } | ||
|
|
||
| lobbyId := request.PathValue("lobby_id") | ||
|
|
||
| // FIXME Do we care about discord anymore? | ||
| api.SetNormalCookie(writer, "lobby-id", lobbyId) | ||
| api.SetNormalCookie(writer, "root-path", handler.basePageConfig.RootPath) | ||
|
|
||
| // Note that this lobby doesn't have to exist necessarily, as the user can still have | ||
| // the data cached locally. | ||
|
|
||
| translation, locale := determineTranslation(request) | ||
| pageData := &galleryPageData{ | ||
| BasePageConfig: handler.basePageConfig, | ||
| LobbyID: lobbyId, | ||
| Translation: translation, | ||
| Locale: locale, | ||
| } | ||
|
|
||
| // If the pagedata isn't initialized, it means the synchronized block has exited. | ||
| // In this case we don't want to template the lobby, since an error has occurred | ||
| // and probably already has been handled. | ||
| if err := pageTemplates.ExecuteTemplate(writer, "gallery-page", pageData); err != nil { | ||
| log.Printf("Error templating lobby: %s\n", err) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| .app { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.5rem; | ||
| padding: 0.5rem; | ||
| box-sizing: border-box; | ||
| height: 100%; | ||
| } | ||
|
|
||
| #drawing-board { | ||
| border-radius: var(--component-border-radius); | ||
| min-height: 0; | ||
| max-width: 100%; | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| } | ||
|
|
||
| .top-bar { | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| padding: 0.5rem; | ||
| background-color: var(--component-base-color); | ||
| border-radius: var(--component-border-radius); | ||
|
|
||
| * { | ||
| font-size: 1.5rem; | ||
| } | ||
| } | ||
|
|
||
| .prev, | ||
| .next { | ||
| border: 1px solid black; | ||
| } | ||
|
|
||
| .prev { | ||
| } | ||
|
|
||
| .next { | ||
| } | ||
Bios-Marcel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.