summaryrefslogtreecommitdiff
path: root/priv/discord_activity.html.eex
blob: 5278400d2c91639f05e6e094a8a608bde6c1615e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<% home_url = "/.proxy/?#{Mediasync.Constants.query_param_discord_activity_inner()}" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="noindex, nofollow">
    <title>discord activity | mediasync</title>
    <style>
        :root {
            --instance-room-info-height: 20svh;
            --instance-room-info-remainder: calc(100svh - var(--instance-room-info-height));
        }

        body {
            overflow: hidden;
            background-color: black;
            color: white;
            font-family: monospace;
        }
        iframe {
            border: none;
        }
        html, body, iframe {
            margin: 0;
            width: 100svw;
            height: 100svh;
        }

        iframe.at-home {
            height: var(--instance-room-info-remainder);
        }

        div#instance-room-info {
            display: none;
            overflow: auto;
        }

        body:has(> iframe.at-home) > div#instance-room-info {
            display: block;
            height: var(--instance-room-info-height);
            border-bottom: 1px solid white;
        }
    </style>
</head>
<body data-csrf-token="<%= Plug.CSRFProtection.get_csrf_token() %>">
    <div id="instance-room-info">
        <span style="font-weight: bold;">currently hosting:</span>
        <div id="instance-room-info-content"></div>
    </div>
    </div>
    <iframe src="<%= home_url %>" style="display: none;" class="at-home" name="activity-inner-iframe"></iframe>
    <script>
        const DISCORD_CLIENT_ID = "<%= Application.fetch_env!(:mediasync, :discord_client_id) %>";
        const ACCESS_TOKEN_URL = "/.proxy/discord_activity/access_token?<%= Mediasync.Constants.query_param_discord_activity_inner() %>";
        const HOME_URL = "<%= home_url %>";
        const roomUrl = (roomId) => {
          return `/.proxy/room/${roomId}?<%= Mediasync.Constants.query_param_discord_activity_inner() %>`;
        };
    </script>
    <script src="/static/discord-embedded-app-sdk/Discord.js" type="module"></script>
    <script src="/static/discordActivity.js" type="module"></script>
</body>
</html>