Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/src/lib/Relive.svelte
  • Loading branch information
Aaronmacaron committed Oct 29, 2023
2 parents 671ffe0 + 42bff85 commit 519ab03
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
Expand Up @@ -40,9 +40,11 @@ public ResponseEntity<RequestAutoUserResponse> requestAutoUser(@RequestBody @Val
new UsernamePasswordAuthenticationToken(newUserDto.getId(), defaultPassword));
SecurityContextHolder.getContext().setAuthentication(authentication);
String jwt = jwtUtils.generateJwtToken(authentication);
newUserDto.setToken(jwt);

return ResponseEntity.status(HttpStatus.CREATED)
.header("Auth", "Bearer " + jwt)
.header("X-Auth", "Bearer " + jwt)
.header("X-bullshit", "aksdjflkasjdflk")
.body(newUserDto);
}

Expand Down
Expand Up @@ -25,6 +25,7 @@ public static class RequestAutoUserResponse {
private int id;
private String name;
private String registrationState;
private String token;
}

@Data
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class UserService {
public RequestAutoUserResponse createAutoUser(String name) {
User newUser = new User(name, User.RegistrationState.AUTO_CREATED, encoder.encode(defaultPassword));
User createdUser = userRepository.save(newUser);
return new RequestAutoUserResponse(createdUser.getId(), createdUser.getName(), createdUser.getRegistrationState().name());
return new RequestAutoUserResponse(createdUser.getId(), createdUser.getName(), createdUser.getRegistrationState().name(), null);
}

public RegisterUserResponse registerUser(int userId, RegisterUserRequest request) {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lib/ImageScroller.svelte
Expand Up @@ -32,8 +32,9 @@
{#each events as event}
<button on:click={() => selectEvent(event)} class="flex-shrink-0">
<img
class="thumbnail bg-gray-500 image-card rounded-md object-cover border-white
{event === selectedEvent ? 'border' : ''}"
class="thumbnail bg-gray-500 image-card rounded-md object-cover
{event === selectedEvent || event.starred ? 'border' : ''}"
style="border-color: {event === selectedEvent ? 'white' : event.starred ? '#FFCD29' : ''}"
alt="Thumbnail"
src={`/media/${event.imageHash}.jpg`}
/>
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/lib/Relive.svelte
Expand Up @@ -26,7 +26,11 @@
const showComments = () => {
showingComments = true;
}
};
const starEvent = () => {
selectedEvent.starred = !selectedEvent.starred;
};
onMount(() => {
Api.get(`events/1/${mediaEndpoint}`).then(res => res.json()).then(e => {
Expand Down Expand Up @@ -60,8 +64,8 @@
<!-- <img src="logoWithText.png" alt="Test" /> -->
<!-- Button Bar -->
<div class="absolute bottom-10 right-1/3 left-1/3 flex justify-center">
<button class="flex items-center px-7 py-3 text-white rounded-l-full" style="background-color:#5C3D95">
<i class="fa fa-star text-2xl mr-2"></i>
<button on:click={starEvent} class="flex items-center px-7 py-3 text-white rounded-l-full" style="background-color:#5C3D95">
<i class="fa fa-star text-2xl mr-2" style="color: {selectedEvent.starred ? '#FFCD29' : 'white'}"></i>
</button>
<button on:click={showComments} class="flex items-center px-7 py-3 text-white rounded-r-full" style="background-color:#5C3D95">
<i class="fa fa-comment text-2xl mr-2"></i>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/api.ts
Expand Up @@ -13,7 +13,6 @@ function post(path: string, body) {
return fetch(DATABASE_URL + path, {
method: 'POST',
headers: { 'content-type': 'application/json' },
credentials: "include",
body: JSON.stringify(body)
}).then((res) => {
if (!res.ok) {
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/routes/events/join/[eventId]/+page.svelte
Expand Up @@ -19,7 +19,8 @@
const eventId = $page.params.eventId;
try {
const response = await api.post(`events/${eventId}/participations`, {});
console.log(response);
const headers = response.headers;
console.log(headers);
goto('/');
} catch (e) {
alert(e);
Expand All @@ -30,7 +31,10 @@
try {
const response = await api.post('users/', { name: name });
const authorizationHeader = response.headers;
console.log(response);
const json =await response.json();
console.log(json);
const token = json.token;
// console.log(response);
// const bearerToken = authorizationHeader.split(' ');
} catch (e) {
alert(e);
Expand Down

0 comments on commit 519ab03

Please sign in to comment.