Skip to content

Commit

Permalink
Fix extension login (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
Excellify authored Oct 25, 2024
1 parent 64fe972 commit fd10d88
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ VITE_APP_SITE="https://7tv.app"
VITE_APP_API="https://7tv.io/v3"
VITE_APP_API_GQL="https://7tv.io/v3/gql"
VITE_APP_API_EVENTS="wss://events.7tv.io/v3"
VITE_APP_API_EGVAULT="https://egvault.7tv.io/v1"
VITE_APP_API_EGVAULT="https://7tv.io/egvault/v1"
VITE_APP_HOST="https://extension.7tv.gg"
3 changes: 1 addition & 2 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ VITE_APP_SITE="https://7tv.app"
VITE_APP_API="https://7tv.io/v3"
VITE_APP_API_GQL="https://7tv.io/v3/gql"
VITE_APP_API_EVENTS="wss://events.7tv.io/v3"
VITE_APP_API_EGVAULT="https://egvault.7tv.io/v1"
VITE_APP_API_EGVAULT="https://7tv.io/egvault/v1"
VITE_APP_HOST="https://extension.7tv.gg"

4 changes: 4 additions & 0 deletions CHANGELOG-nightly.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.1.3.1000

- Fixed extension login

### 3.1.2.4000

- Fixed a bug that could cause issues when clicking an emoji in chat
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"displayName": "7TV",
"description": "Improve your viewing experience on Twitch & YouTube with new features, emotes, vanity and performance.",
"private": true,
"version": "3.1.2",
"dev_version": "4.0",
"version": "3.1.3",
"dev_version": "1.0",
"scripts": {
"start": "NODE_ENV=dev yarn build:dev && NODE_ENV=dev vite --mode dev",
"build:section:app": "vite build --config vite.config.mts",
Expand Down
3 changes: 1 addition & 2 deletions src/apollo/apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { ApolloClient, ApolloLink, InMemoryCache, createHttpLink } from "@apollo

export const httpLink = createHttpLink({
uri: import.meta.env.VITE_APP_API_GQL,
credentials: "include",
});

const token = useConfig<string>("app.7tv.token");
const authLink = new ApolloLink((op, next) => {
const jwt = decodeJWT(token.value);
if (!jwt || jwt.exp * 1000 < Date.now()) {
if (!jwt || jwt.exp * 1000 < Date.now() || !jwt.sub) {
token.value = "";
return next(op);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/settings/SettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<div
v-if="actor.token"
class="seventv-settings-sidebar-profile-logout seventv-settings-expanded"
@click="actor.logout()"
@click.stop="actor.logout"
>
<LogoutIcon />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/common/Constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const UNICODE_TAG_0_REGEX = new RegExp(UNICODE_TAG_0, "g");

export const HOSTNAME_SUPPORTED_REGEXP = /([a-z0-9]+[.])*(youtube|kick)[.]com/;
export const SEVENTV_EMOTE_LINK = new RegExp(
"https?:\\/\\/(?:www\\.)?7tv.app\\/emotes\\/(?<emoteID>[0-9a-f]{24})",
"https?:\\/\\/(?:www\\.)?7tv.app\\/emotes\\/(?<emoteID>[0-7][0-9A-HJKMNP-TV-Z]{25})",
"i",
);
export const SEVENTV_EMOTE_ID = new RegExp("[0-9a-f]{24}");
Expand Down
4 changes: 2 additions & 2 deletions src/common/Roles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum SevenTVRoles {
ADMIN = "6102002eab1aa12bf648cfcd",
MODERATOR = "60724f65e93d828bf8858789",
ADMIN = "01FBQX1CXG000AP6N15FV4HKYD",
MODERATOR = "01F2Z8C8M8000EJFC2HFW8B1W9",
}
8 changes: 2 additions & 6 deletions src/composable/useActor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionKey, inject, provide, reactive, toRaw, watch } from "vue";
import { InjectionKey, inject, nextTick, provide, reactive, toRaw, watch } from "vue";
import { useConfig } from "@/composable/useSettings";
import { userByConnectionQuery, userQuery } from "@/assets/gql/seventv.user.gql";
import { SubscriptionResponse, useEgVault } from "@/app/store/egvault";
Expand All @@ -23,11 +23,7 @@ class ActorContext {
}

logout(): void {
fetch(import.meta.env.VITE_APP_API + "/auth/logout", {
method: "POST",
credentials: "include",
}).then(() => {
// So the user can re-authenticate if needed
nextTick(() => {
this.token = "";
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/composable/useSetMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useSetMutation(setID?: string): SetMutation {
() => ctx.user,
(u) => {
if (!u) return;
setID = u.connections?.find((s) => s.platform === ctx.platform)?.emote_set?.id;
setID = u.connections?.find((s) => s.platform === ctx.platform)?.emote_set_id;
},
{ immediate: true },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const actor = useActor();
const perms = [SevenTVRoles.ADMIN, SevenTVRoles.MODERATOR] as string[];
const commandEditAnySet: Twitch.ChatCommand = {
name: "letmemamageemoteset",
name: "letmemanageemoteset",
description: "<Mod> Lets you edit any 7TV emote set",
helpText: "",
permissionLevel: 0,
Expand Down
5 changes: 2 additions & 3 deletions src/types/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ declare namespace SevenTV {
}

interface JWT {
u: string;
v: number;
iss: string;
sub: string;
exp: number;
nbf: number;
iat: number;
jti: string;
}

interface EmoteSet {
Expand Down

0 comments on commit fd10d88

Please sign in to comment.