Skip to content

Commit

Permalink
fix: added client id config
Browse files Browse the repository at this point in the history
  • Loading branch information
igorgoldobin committed Feb 12, 2024
1 parent d1bf819 commit 7c06c9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions internal/server/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type infoResponse struct {
RemoteAddr string `json:"remote_addr,omitempty"`
Forward string `json:"forward,omitempty"`
RealIP string `json:"real_ip,omitempty"`
DiscorClientId string `json:"discord_client_id"`
}

type authResponse struct {
Expand Down
1 change: 1 addition & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (s *Server) handleInfo() http.HandlerFunc {
RemoteAddr: r.RemoteAddr,
Forward: r.Header.Get("X-Forwarded-For"),
RealIP: r.Header.Get("X-Real-IP"),
DiscorClientId: s.cfg.discordClientId,
}, http.StatusOK)
}
}
Expand Down
10 changes: 7 additions & 3 deletions web/src/Faucet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@
payout: 1,
symbol: 'ETH',
hcaptcha_sitekey: '',
discord_client_id: '',
};
let loggedIn = false;
let mounted = false;
let hcaptchaLoaded = false;
let loginUrl = `https://discord.com/api/oauth2/authorize?client_id=1206392566468321340&redirect_uri=${window.location.href}&response_type=code&scope=identify%20email`;
let loginUrl = '';
onMount(async () => {
const params = new URLSearchParams(window.location.search);
const code = params.get('code');
const res = await fetch('/api/info');
faucetInfo = await res.json();
loginUrl = `https://discord.com/api/oauth2/authorize?client_id=${faucetInfo.discord_client_id}&redirect_uri=${window.location.href}&response_type=code&scope=identify%20email`;
await checkAuthentication();
if (code) {
Expand All @@ -36,8 +41,7 @@
checkNetwork();
});
}
const res = await fetch('/api/info');
faucetInfo = await res.json();
mounted = true;
});
Expand Down

0 comments on commit 7c06c9f

Please sign in to comment.