mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-09 15:50:53 +00:00
4.0.0-rc13.5
* Fixed: Stream up-time on channels. * Fixed: More improvements to GraphQL merging logic. * Fixed: Remove debug logging.
This commit is contained in:
parent
551a08bfd0
commit
87f3f1835b
9 changed files with 106 additions and 78 deletions
|
@ -100,7 +100,7 @@ class FrankerFaceZ extends Module {
|
||||||
FrankerFaceZ.Logger = Logger;
|
FrankerFaceZ.Logger = Logger;
|
||||||
|
|
||||||
const VER = FrankerFaceZ.version_info = {
|
const VER = FrankerFaceZ.version_info = {
|
||||||
major: 4, minor: 0, revision: 0, extra: '-rc13.4',
|
major: 4, minor: 0, revision: 0, extra: '-rc13.5',
|
||||||
commit: __git_commit__,
|
commit: __git_commit__,
|
||||||
build: __webpack_hash__,
|
build: __webpack_hash__,
|
||||||
toString: () =>
|
toString: () =>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import Module from 'utilities/module';
|
import Module from 'utilities/module';
|
||||||
import { get } from 'utilities/object';
|
import { get } from 'utilities/object';
|
||||||
|
|
||||||
import CHANNEL_QUERY from './channel_bar_query.gql';
|
import CHANNEL_QUERY from './channel_page_query.gql';
|
||||||
|
|
||||||
export default class ChannelBar extends Module {
|
export default class ChannelBar extends Module {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
query {
|
query ChannelPage_ChannelHeader {
|
||||||
user {
|
user {
|
||||||
stream {
|
stream {
|
||||||
createdAt
|
createdAt
|
14
src/sites/twitch-twilight/modules/channel_page_query.gql
Normal file
14
src/sites/twitch-twilight/modules/channel_page_query.gql
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
fragment channel on User {
|
||||||
|
stream {
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment hostingChannel on User {
|
||||||
|
hosting {
|
||||||
|
stream {
|
||||||
|
createdAt
|
||||||
|
type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import {ColorAdjuster} from 'utilities/color';
|
import {ColorAdjuster} from 'utilities/color';
|
||||||
import {setChildren} from 'utilities/dom';
|
import {setChildren} from 'utilities/dom';
|
||||||
import {has, split_chars, shallow_object_equals} from 'utilities/object';
|
import {has, make_enum, split_chars, shallow_object_equals} from 'utilities/object';
|
||||||
import {FFZEvent} from 'utilities/events';
|
import {FFZEvent} from 'utilities/events';
|
||||||
|
|
||||||
import Module from 'utilities/module';
|
import Module from 'utilities/module';
|
||||||
|
@ -43,72 +43,67 @@ const REGEX_EMOTES = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const MESSAGE_TYPES = ((e = {}) => {
|
const MESSAGE_TYPES = make_enum(
|
||||||
e[e.Post = 0] = 'Post';
|
'Post',
|
||||||
e[e.Action = 1] = 'Action';
|
'Action',
|
||||||
e[e.PostWithMention = 2] = 'PostWithMention';
|
'PostWithMention'
|
||||||
return e;
|
);
|
||||||
})();
|
|
||||||
|
|
||||||
|
const MOD_TYPES = make_enum(
|
||||||
|
'Ban',
|
||||||
|
'Timeout',
|
||||||
|
'Delete'
|
||||||
|
);
|
||||||
|
|
||||||
const MOD_TYPES = ((e = {}) => {
|
const AUTOMOD_TYPES = make_enum(
|
||||||
e[e.Ban = 0] = 'Ban';
|
'MessageRejectedPrompt',
|
||||||
e[e.Timeout = 1] = 'Timeout';
|
'CheerMessageRejectedPrompt',
|
||||||
e[e.Delete = 2] = 'Delete';
|
'MessageRejected',
|
||||||
return e;
|
'MessageAllowed',
|
||||||
})();
|
'MessageDenied',
|
||||||
|
'CheerMessageDenied',
|
||||||
|
'CheerMessageTimeout',
|
||||||
|
'MessageModApproved',
|
||||||
|
'MessageModDenied'
|
||||||
|
);
|
||||||
|
|
||||||
|
const CHAT_TYPES = make_enum(
|
||||||
const AUTOMOD_TYPES = ((e = {}) => {
|
'Message',
|
||||||
e[e.MessageRejectedPrompt = 0] = 'MessageRejectedPrompt';
|
'ExtensionMessage',
|
||||||
e[e.CheerMessageRejectedPrompt = 1] = 'CheerMessageRejectedPrompt';
|
'Moderation',
|
||||||
e[e.MessageRejected = 2] = 'MessageRejected';
|
'ModerationAction',
|
||||||
e[e.MessageAllowed = 3] = 'MessageAllowed';
|
'TargetedModerationAction',
|
||||||
e[e.MessageDenied = 4] = 'MessageDenied';
|
'AutoMod',
|
||||||
e[e.CheerMessageDenied = 5] = 'CheerMessageDenied';
|
'SubscriberOnlyMode',
|
||||||
e[e.CheerMessageTimeout = 6] = 'CheerMessageTimeout';
|
'FollowerOnlyMode',
|
||||||
return e;
|
'SlowMode',
|
||||||
})();
|
'EmoteOnlyMode',
|
||||||
|
'R9KMode',
|
||||||
|
'Connected',
|
||||||
const CHAT_TYPES = ((e = {}) => {
|
'Disconnected',
|
||||||
e[e.Message = 0] = 'Message';
|
'Reconnect',
|
||||||
e[e.ExtensionMessage = 1] = 'ExtensionMessage';
|
'Hosting',
|
||||||
e[e.Moderation = 2] = 'Moderation';
|
'Unhost',
|
||||||
e[e.ModerationAction = 3] = 'ModerationAction';
|
'Hosted',
|
||||||
e[e.TargetedModerationAction = 4] = 'TargetedModerationAction';
|
'Subscription',
|
||||||
e[e.AutoMod = 5] = 'AutoMod';
|
'Resubscription',
|
||||||
e[e.SubscriberOnlyMode = 6] = 'SubscriberOnlyMode';
|
'GiftPaidUpgrade',
|
||||||
e[e.FollowerOnlyMode = 7] = 'FollowerOnlyMode';
|
'SubGift',
|
||||||
e[e.SlowMode = 8] = 'SlowMode';
|
'Clear',
|
||||||
e[e.EmoteOnlyMode = 9] = 'EmoteOnlyMode';
|
'RoomMods',
|
||||||
e[e.R9KMode = 10] = 'R9KMode';
|
'RoomState',
|
||||||
e[e.Connected = 11] = 'Connected';
|
'Raid',
|
||||||
e[e.Disconnected = 12] = 'Disconnected';
|
'Unraid',
|
||||||
e[e.Reconnect = 13] = 'Reconnect';
|
'Ritual',
|
||||||
e[e.Hosting = 14] = 'Hosting';
|
'Notice',
|
||||||
e[e.Unhost = 15] = 'Unhost';
|
'Info',
|
||||||
e[e.Hosted = 16] = 'Hosted';
|
'BadgesUpdated',
|
||||||
e[e.Subscription = 17] = 'Subscription';
|
'Purchase',
|
||||||
e[e.Resubscription = 18] = 'Resubscription';
|
'BitsCharity',
|
||||||
e[e.GiftPaidUpgrade = 19] = 'GiftPaidUpgrade';
|
'CrateGift',
|
||||||
e[e.SubGift = 20] = 'SubGift';
|
'RewardGift',
|
||||||
e[e.Clear = 21] = 'Clear';
|
'SubMysteryGift'
|
||||||
e[e.RoomMods = 22] = 'RoomMods';
|
);
|
||||||
e[e.RoomState = 23] = 'RoomState';
|
|
||||||
e[e.Raid = 24] = 'Raid';
|
|
||||||
e[e.Unraid = 25] = 'Unraid';
|
|
||||||
e[e.Ritual = 26] = 'Ritual';
|
|
||||||
e[e.Notice = 27] = 'Notice';
|
|
||||||
e[e.Info = 28] = 'Info';
|
|
||||||
e[e.BadgesUpdated = 29] = 'BadgesUpdated';
|
|
||||||
e[e.Purchase = 30] = 'Purchase';
|
|
||||||
e[e.BitsCharity = 31] = 'BitsCharity';
|
|
||||||
e[e.CrateGift = 32] = 'CrateGift';
|
|
||||||
e[e.RewardGift = 33] = 'RewardGift';
|
|
||||||
e[e.SubMysteryGift = 34] = 'SubMysteryGift';
|
|
||||||
return e;
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
const NULL_TYPES = [
|
const NULL_TYPES = [
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import Module from 'utilities/module';
|
import Module from 'utilities/module';
|
||||||
import {get, deep_copy} from 'utilities/object';
|
import {get, deep_copy} from 'utilities/object';
|
||||||
|
|
||||||
import CHANNEL_QUERY from './channel_bar_query.gql';
|
import CHANNEL_QUERY from './channel_header_query.gql';
|
||||||
|
|
||||||
|
|
||||||
export default class LegacyChannelBar extends Module {
|
export default class LegacyChannelBar extends Module {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
import Module from 'utilities/module';
|
import Module from 'utilities/module';
|
||||||
import {get, deep_copy} from 'utilities/object';
|
import {get} from 'utilities/object';
|
||||||
import merge from 'utilities/graphql';
|
import merge from 'utilities/graphql';
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,9 +213,6 @@ export default class Apollo extends Module {
|
||||||
query = query_map && query_map.get(id),
|
query = query_map && query_map.get(id),
|
||||||
modifiers = this.modifiers[operation];
|
modifiers = this.modifiers[operation];
|
||||||
|
|
||||||
|
|
||||||
const pre_modification = deep_copy(request.query);
|
|
||||||
|
|
||||||
if ( modifiers ) {
|
if ( modifiers ) {
|
||||||
for(const mod of modifiers) {
|
for(const mod of modifiers) {
|
||||||
if ( typeof mod === 'function' )
|
if ( typeof mod === 'function' )
|
||||||
|
@ -249,8 +246,6 @@ export default class Apollo extends Module {
|
||||||
this.log.info('Unable to find GQL Print. Clearing store for query:', operation);
|
this.log.info('Unable to find GQL Print. Clearing store for query:', operation);
|
||||||
this.client.queryManager.queryStore.store[id] = null;
|
this.client.queryManager.queryStore.store[id] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log.info('Query', operation, pre_modification, request.query, request.variables);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apolloPostFlight(response) {
|
apolloPostFlight(response) {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import { deep_copy } from "./object";
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@ -77,11 +75,15 @@ export const MERGE_METHODS = {
|
||||||
|
|
||||||
|
|
||||||
export function mergeList(a, b) {
|
export function mergeList(a, b) {
|
||||||
|
let has_operation = false;
|
||||||
const a_names = {};
|
const a_names = {};
|
||||||
for(const item of a) {
|
for(const item of a) {
|
||||||
if ( ! item || ! item.name || item.name.kind !== 'Name' )
|
if ( ! item || ! item.name || item.name.kind !== 'Name' )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ( item.operation )
|
||||||
|
has_operation = true;
|
||||||
|
|
||||||
a_names[item.name.value] = item;
|
a_names[item.name.value] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +94,20 @@ export function mergeList(a, b) {
|
||||||
const name = item.name.value,
|
const name = item.name.value,
|
||||||
idx = a_names[name] ? a.indexOf(a_names[name]) : -1;
|
idx = a_names[name] ? a.indexOf(a_names[name]) : -1;
|
||||||
|
|
||||||
if ( idx !== -1 )
|
if ( idx !== -1 ) {
|
||||||
|
if ( a[idx].operation && item.operation && a[idx].operation !== item.operation )
|
||||||
|
continue;
|
||||||
|
|
||||||
a[idx] = merge(a[idx], item);
|
a[idx] = merge(a[idx], item);
|
||||||
else
|
if ( a[idx].operation )
|
||||||
|
has_operation = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if ( has_operation && item.operation )
|
||||||
|
continue;
|
||||||
|
|
||||||
a.push(item);
|
a.push(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
|
|
@ -11,6 +11,18 @@ export function sleep(delay) {
|
||||||
return new Promise(s => setTimeout(s, delay));
|
return new Promise(s => setTimeout(s, delay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function make_enum(...array) {
|
||||||
|
const out = {};
|
||||||
|
|
||||||
|
for(let i=0; i < array.length; i++) {
|
||||||
|
const word = array[i];
|
||||||
|
out[word] = i;
|
||||||
|
out[i] = word;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function timeout(promise, delay) {
|
export function timeout(promise, delay) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue