1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-02 16:08:31 +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:
SirStendec 2018-10-16 18:04:54 -04:00
parent 551a08bfd0
commit 87f3f1835b
9 changed files with 106 additions and 78 deletions

View file

@ -100,7 +100,7 @@ class FrankerFaceZ extends Module {
FrankerFaceZ.Logger = Logger;
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__,
build: __webpack_hash__,
toString: () =>

View file

@ -7,7 +7,7 @@
import Module from 'utilities/module';
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 {
constructor(...args) {

View file

@ -1,4 +1,4 @@
query {
query ChannelPage_ChannelHeader {
user {
stream {
createdAt

View file

@ -0,0 +1,14 @@
fragment channel on User {
stream {
createdAt
}
}
fragment hostingChannel on User {
hosting {
stream {
createdAt
type
}
}
}

View file

@ -6,7 +6,7 @@
import {ColorAdjuster} from 'utilities/color';
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 Module from 'utilities/module';
@ -43,72 +43,67 @@ const REGEX_EMOTES = {
};
const MESSAGE_TYPES = ((e = {}) => {
e[e.Post = 0] = 'Post';
e[e.Action = 1] = 'Action';
e[e.PostWithMention = 2] = 'PostWithMention';
return e;
})();
const MESSAGE_TYPES = make_enum(
'Post',
'Action',
'PostWithMention'
);
const MOD_TYPES = make_enum(
'Ban',
'Timeout',
'Delete'
);
const MOD_TYPES = ((e = {}) => {
e[e.Ban = 0] = 'Ban';
e[e.Timeout = 1] = 'Timeout';
e[e.Delete = 2] = 'Delete';
return e;
})();
const AUTOMOD_TYPES = make_enum(
'MessageRejectedPrompt',
'CheerMessageRejectedPrompt',
'MessageRejected',
'MessageAllowed',
'MessageDenied',
'CheerMessageDenied',
'CheerMessageTimeout',
'MessageModApproved',
'MessageModDenied'
);
const AUTOMOD_TYPES = ((e = {}) => {
e[e.MessageRejectedPrompt = 0] = 'MessageRejectedPrompt';
e[e.CheerMessageRejectedPrompt = 1] = 'CheerMessageRejectedPrompt';
e[e.MessageRejected = 2] = 'MessageRejected';
e[e.MessageAllowed = 3] = 'MessageAllowed';
e[e.MessageDenied = 4] = 'MessageDenied';
e[e.CheerMessageDenied = 5] = 'CheerMessageDenied';
e[e.CheerMessageTimeout = 6] = 'CheerMessageTimeout';
return e;
})();
const CHAT_TYPES = ((e = {}) => {
e[e.Message = 0] = 'Message';
e[e.ExtensionMessage = 1] = 'ExtensionMessage';
e[e.Moderation = 2] = 'Moderation';
e[e.ModerationAction = 3] = 'ModerationAction';
e[e.TargetedModerationAction = 4] = 'TargetedModerationAction';
e[e.AutoMod = 5] = 'AutoMod';
e[e.SubscriberOnlyMode = 6] = 'SubscriberOnlyMode';
e[e.FollowerOnlyMode = 7] = 'FollowerOnlyMode';
e[e.SlowMode = 8] = 'SlowMode';
e[e.EmoteOnlyMode = 9] = 'EmoteOnlyMode';
e[e.R9KMode = 10] = 'R9KMode';
e[e.Connected = 11] = 'Connected';
e[e.Disconnected = 12] = 'Disconnected';
e[e.Reconnect = 13] = 'Reconnect';
e[e.Hosting = 14] = 'Hosting';
e[e.Unhost = 15] = 'Unhost';
e[e.Hosted = 16] = 'Hosted';
e[e.Subscription = 17] = 'Subscription';
e[e.Resubscription = 18] = 'Resubscription';
e[e.GiftPaidUpgrade = 19] = 'GiftPaidUpgrade';
e[e.SubGift = 20] = 'SubGift';
e[e.Clear = 21] = 'Clear';
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 CHAT_TYPES = make_enum(
'Message',
'ExtensionMessage',
'Moderation',
'ModerationAction',
'TargetedModerationAction',
'AutoMod',
'SubscriberOnlyMode',
'FollowerOnlyMode',
'SlowMode',
'EmoteOnlyMode',
'R9KMode',
'Connected',
'Disconnected',
'Reconnect',
'Hosting',
'Unhost',
'Hosted',
'Subscription',
'Resubscription',
'GiftPaidUpgrade',
'SubGift',
'Clear',
'RoomMods',
'RoomState',
'Raid',
'Unraid',
'Ritual',
'Notice',
'Info',
'BadgesUpdated',
'Purchase',
'BitsCharity',
'CrateGift',
'RewardGift',
'SubMysteryGift'
);
const NULL_TYPES = [

View file

@ -7,7 +7,7 @@
import Module from 'utilities/module';
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 {

View file

@ -6,7 +6,7 @@
// ============================================================================
import Module from 'utilities/module';
import {get, deep_copy} from 'utilities/object';
import {get} from 'utilities/object';
import merge from 'utilities/graphql';
@ -213,9 +213,6 @@ export default class Apollo extends Module {
query = query_map && query_map.get(id),
modifiers = this.modifiers[operation];
const pre_modification = deep_copy(request.query);
if ( modifiers ) {
for(const mod of modifiers) {
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.client.queryManager.queryStore.store[id] = null;
}
this.log.info('Query', operation, pre_modification, request.query, request.variables);
}
apolloPostFlight(response) {

View file

@ -1,5 +1,3 @@
import { deep_copy } from "./object";
'use strict';
// ============================================================================
@ -77,11 +75,15 @@ export const MERGE_METHODS = {
export function mergeList(a, b) {
let has_operation = false;
const a_names = {};
for(const item of a) {
if ( ! item || ! item.name || item.name.kind !== 'Name' )
continue;
if ( item.operation )
has_operation = true;
a_names[item.name.value] = item;
}
@ -92,10 +94,20 @@ export function mergeList(a, b) {
const name = item.name.value,
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);
else
if ( a[idx].operation )
has_operation = true;
} else {
if ( has_operation && item.operation )
continue;
a.push(item);
}
}
return a;

View file

@ -11,6 +11,18 @@ export function sleep(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) {
return new Promise((resolve, reject) => {