Skip to content

Commit

Permalink
Merge branch 'dev' into npiano/fix-timing-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasPiano committed May 25, 2023
2 parents aa0a0b8 + fde5d62 commit d72cba0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,500;0,700;1,300;1,500;1,700&display=swap"
rel="stylesheet" />
<title>Threads</title>
<title>nymspace</title>
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Shared/FooterSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
target="_blank"
class="text-xl self-center"
>
Threads GitHub
<img :src="githubLogo" alt="Threads GitHub" class="inline-block w-8" />
nymspace GitHub
<img :src="githubLogo" alt="nymspace GitHub" class="inline-block w-8" />
</a>
</div>
</template>
Expand Down
9 changes: 2 additions & 7 deletions src/components/Shared/HeaderSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
>
<div>
<router-link to="/" class="text-4xl">
<img
src="/images/threads-logo-v1.svg"
alt="Threads"
class="w-12 inline-block"
/>
<p class="inline-block text-red-600">Threads</p>
<p class="inline-block text-red-600">nymspace</p>
</router-link>
<a
v-if="showVersion"
Expand All @@ -36,7 +31,7 @@
href="https://cyber.harvard.edu/projects/nymity"
rel="noopener"
target="_blank"
>About Threads<ExternalLinkIcon class="ml-1 inline-block w-4 h-4" />
>About Nymity<ExternalLinkIcon class="ml-1 inline-block w-4 h-4" />
</a>
</div>
</div>
Expand Down
18 changes: 14 additions & 4 deletions src/views/MessagesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ const updatedMsgs = computed((x) => {
/**
* Send message via ws
*/
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return JSON.parse(jsonPayload);
}
async function sendMessage() {
if (message.value.trim().length > 0 && !getActiveThread.value?.locked && !pseudonymMismatch.value) {
try {
Expand Down Expand Up @@ -419,15 +429,15 @@ const reconnectSockets = () =>{
}
onMounted(async () => {
wsInstance.value = new SocketioService();
wsInstance.value.addDisconnectHandler(reconnectSockets);
reconnectSockets();
const user = await loadUser();
goodReputation.value = user.goodReputation;
await fetchMessages(route.params.threadId);
await fetchThreadDetails(route.params.threadId);
messageTextArea.value?.focus();
wsInstance.value = new SocketioService();
wsInstance.value.addDisconnectHandler(reconnectSockets);
reconnectSockets();
});
onUnmounted(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/views/ThreadsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ const reconnectSockets = () =>{
}
onMounted(async () => {
wsInstance.value = new SocketioService();
wsInstance.value.addDisconnectHandler(reconnectSockets);
reconnectSockets();
await loadUserThreads();
await loadThreads(route.params.channelId);
Expand All @@ -189,6 +185,10 @@ onMounted(async () => {
channel.value = getChannel(route.params.channelId);
}
wsInstance.value = new SocketioService();
wsInstance.value.addDisconnectHandler(reconnectSockets);
reconnectSockets();
setActiveChannel(channel.value);
});
Expand Down

0 comments on commit d72cba0

Please sign in to comment.