1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-25 03:58:30 +00:00

More bugfixes. Actually implement the API test experiment.

This commit is contained in:
SirStendec 2018-04-12 02:29:43 -04:00
parent 99f9974dea
commit 1b2ff27530
10 changed files with 57 additions and 13 deletions

View file

@ -1,3 +1,9 @@
<div class="list-header">4.0.0-beta2.13<span>@64fec6b80d1f6a60c263</span> <time datetime="2018-04-12">(2018-04-12)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Issue sorting settings on Edge and Safari.</li>
<li>Fixed: Issue processing metadata on game pages when broadcasters aren't defined.</li>
</ul>
<div class="list-header">4.0.0-beta2.13<span>@64fec6b80d1f6a60c263</span> <time datetime="2018-04-11">(2018-04-11)</time></div> <div class="list-header">4.0.0-beta2.13<span>@64fec6b80d1f6a60c263</span> <time datetime="2018-04-11">(2018-04-11)</time></div>
<ul class="chat-menu-content menu-side-padding"> <ul class="chat-menu-content menu-side-padding">
<li>Changed: Only use the ES2015 classes transform for the Edge build as their JS engine seems to get everything else correct.</li> <li>Changed: Only use the ES2015 classes transform for the Edge build as their JS engine seems to get everything else correct.</li>

View file

@ -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: '-beta2.13', major: 4, minor: 0, revision: 0, extra: '-beta2.14',
build: __webpack_hash__, build: __webpack_hash__,
toString: () => toString: () =>
`${VER.major}.${VER.minor}.${VER.revision}${VER.extra || ''}${DEBUG ? '-dev' : ''}` `${VER.major}.${VER.minor}.${VER.revision}${VER.extra || ''}${DEBUG ? '-dev' : ''}`

View file

@ -4,7 +4,7 @@
// Badge Handling // Badge Handling
// ============================================================================ // ============================================================================
import {API_SERVER, IS_WEBKIT, WEBKIT_CSS as WEBKIT} from 'utilities/constants'; import {NEW_API, API_SERVER, IS_WEBKIT, WEBKIT_CSS as WEBKIT} from 'utilities/constants';
import {createElement, ManagedStyle} from 'utilities/dom'; import {createElement, ManagedStyle} from 'utilities/dom';
import {has} from 'utilities/object'; import {has} from 'utilities/object';
@ -140,6 +140,7 @@ export default class Badges extends Module {
this.inject('settings'); this.inject('settings');
this.inject('socket'); this.inject('socket');
this.inject('tooltips'); this.inject('tooltips');
this.inject('experiments');
this.style = new ManagedStyle('badges'); this.style = new ManagedStyle('badges');
this.badges = {}; this.badges = {};
@ -496,6 +497,12 @@ export default class Badges extends Module {
async loadGlobalBadges(tries = 0) { async loadGlobalBadges(tries = 0) {
let response, data; let response, data;
if ( this.experiments.getAssignment('api_load') )
try {
fetch(`${NEW_API}/v1/badges`).catch(() => {});
} catch(err) { /* do nothing */ }
try { try {
response = await fetch(`${API_SERVER}/v1/badges`); response = await fetch(`${API_SERVER}/v1/badges`);
} catch(err) { } catch(err) {

View file

@ -7,7 +7,7 @@
import Module from 'utilities/module'; import Module from 'utilities/module';
import {ManagedStyle} from 'utilities/dom'; import {ManagedStyle} from 'utilities/dom';
import {has, timeout, SourcedSet} from 'utilities/object'; import {has, timeout, SourcedSet} from 'utilities/object';
import {CLIENT_ID, API_SERVER, IS_OSX} from 'utilities/constants'; import {CLIENT_ID, NEW_API, API_SERVER, IS_OSX} from 'utilities/constants';
const MOD_KEY = IS_OSX ? 'metaKey' : 'ctrlKey'; const MOD_KEY = IS_OSX ? 'metaKey' : 'ctrlKey';
@ -60,6 +60,7 @@ export default class Emotes extends Module {
this.inject('socket'); this.inject('socket');
this.inject('settings'); this.inject('settings');
this.inject('experiments');
this.twitch_inventory_sets = new Set(EXTRA_INVENTORY); this.twitch_inventory_sets = new Set(EXTRA_INVENTORY);
this.__twitch_emote_to_set = new Map; this.__twitch_emote_to_set = new Map;
@ -133,9 +134,13 @@ export default class Emotes extends Module {
providers = emote_sets._sources; providers = emote_sets._sources;
if ( providers && providers.has('featured') ) if ( providers && providers.has('featured') )
for(const item of providers.get('featured')) for(const item of providers.get('featured')) {
if ( ! new_sets.includes(item) ) const idx = new_sets.indexOf(item);
if ( idx === -1 )
room.removeSet('featured', item); room.removeSet('featured', item);
else
new_sets.splice(idx, 1);
}
for(const set_id of new_sets) { for(const set_id of new_sets) {
room.addSet('featured', set_id); room.addSet('featured', set_id);
@ -424,6 +429,12 @@ export default class Emotes extends Module {
async loadGlobalSets(tries = 0) { async loadGlobalSets(tries = 0) {
let response, data; let response, data;
if ( this.experiments.getAssignment('api_load') )
try {
fetch(`${NEW_API}/v1/set/global`).catch(() => {});
} catch(err) { /* do nothing */ }
try { try {
response = await fetch(`${API_SERVER}/v1/set/global`) response = await fetch(`${API_SERVER}/v1/set/global`)
} catch(err) { } catch(err) {
@ -461,6 +472,12 @@ export default class Emotes extends Module {
async loadSet(set_id, suppress_log = false, tries = 0) { async loadSet(set_id, suppress_log = false, tries = 0) {
let response, data; let response, data;
if ( this.experiments.getAssignment('api_load') )
try {
fetch(`${NEW_API}/v1/set/${set_id}`).catch(() => {});
} catch(err) { /* do nothing */ }
try { try {
response = await fetch(`${API_SERVER}/v1/set/${set_id}`) response = await fetch(`${API_SERVER}/v1/set/${set_id}`)
} catch(err) { } catch(err) {

View file

@ -10,6 +10,7 @@ import {timeout, has} from 'utilities/object';
import Badges from './badges'; import Badges from './badges';
import Emotes from './emotes'; import Emotes from './emotes';
//import Emoji from './emoji';
import Room from './room'; import Room from './room';
import User from './user'; import User from './user';
@ -27,9 +28,11 @@ export default class Chat extends Module {
this.inject('i18n'); this.inject('i18n');
this.inject('tooltips'); this.inject('tooltips');
this.inject('socket'); this.inject('socket');
this.inject('experiments');
this.inject(Badges); this.inject(Badges);
this.inject(Emotes); this.inject(Emotes);
//this.inject(Emoji);
this._link_info = {}; this._link_info = {};

View file

@ -6,7 +6,7 @@
import User from './user'; import User from './user';
import {API_SERVER, WEBKIT_CSS as WEBKIT} from 'utilities/constants'; import {NEW_API, API_SERVER, WEBKIT_CSS as WEBKIT} from 'utilities/constants';
import {ManagedStyle} from 'utilities/dom'; import {ManagedStyle} from 'utilities/dom';
import {has, SourcedSet} from 'utilities/object'; import {has, SourcedSet} from 'utilities/object';
@ -175,6 +175,11 @@ export default class Room {
if ( this.destroyed ) if ( this.destroyed )
return; return;
if ( this.manager.experiments.getAssignment('api_load') )
try {
fetch(`${NEW_API}/v1/rooms/${this.id ? `id/${this.id}` : this.login}`).catch(() => {});
} catch(err) { /* do nothing */ }
let response, data; let response, data;
try { try {
response = await fetch(`${API_SERVER}/v1/room/${this.id ? `id/${this.id}` : this.login}`); response = await fetch(`${API_SERVER}/v1/room/${this.id ? `id/${this.id}` : this.login}`);

View file

@ -375,7 +375,7 @@ export default class MainMenu extends Module {
if ( a.sort < b.sort ) return -1; if ( a.sort < b.sort ) return -1;
if ( a.sort > b.sort ) return 1; if ( a.sort > b.sort ) return 1;
return a.key.localeCompare(b.key); return a.key && a.key.localeCompare(b.key);
}); });
this.log.info(`Built Tree in ${(performance.now() - started).toFixed(5)}ms with ${Object.keys(tree).length} structure nodes and ${this._settings_count} settings nodes.`); this.log.info(`Built Tree in ${(performance.now() - started).toFixed(5)}ms with ${Object.keys(tree).length} structure nodes and ${this._settings_count} settings nodes.`);

View file

@ -198,14 +198,17 @@ export default class Directory extends SiteModule {
if (!edges) return res; if (!edges) return res;
for (let i = 0; i < edges.length; i++) { for (let i = 0; i < edges.length; i++) {
const edge = edges[i]; const edge = edges[i],
const node = edge.node; node = edge.node || edge;
const s = node.viewersCount = new Number(node.viewersCount || 0); const s = node.viewersCount = new Number(node.viewersCount || 0);
s.profileImageURL = node.broadcaster.profileImageURL;
s.createdAt = node.createdAt; s.createdAt = node.createdAt;
s.login = node.broadcaster.login;
s.displayName = node.broadcaster.displayName; if ( node.broadcaster ) {
s.profileImageURL = node.broadcaster.profileImageURL;
s.login = node.broadcaster.login;
s.displayName = node.broadcaster.displayName;
}
if (gamePage || (!node.game || node.game && !blockedGames.includes(node.game.name))) newStreams.push(edge); if (gamePage || (!node.game || node.game && !blockedGames.includes(node.game.name))) newStreams.push(edge);
} }

View file

@ -13,7 +13,9 @@ const BAD_ERRORS = [
'timeout', 'timeout',
'unable to load', 'unable to load',
'error internal', 'error internal',
'Internal Server Error' 'Internal Server Error',
'http://',
'https://'
]; ];
function skip_error(err) { function skip_error(err) {

View file

@ -5,6 +5,7 @@ export const SERVER = DEBUG ? '//localhost:8000' : 'https://cdn.frankerfacez.com
export const CLIENT_ID = 'a3bc9znoz6vi8ozsoca0inlcr4fcvkl'; export const CLIENT_ID = 'a3bc9znoz6vi8ozsoca0inlcr4fcvkl';
export const API_SERVER = '//api.frankerfacez.com'; export const API_SERVER = '//api.frankerfacez.com';
export const NEW_API = '//api-test.frankerfacez.com';
export const SENTRY_ID = 'https://18f42c65339d4164b3fdebfc8c8bc99b@sentry.io/1186960'; export const SENTRY_ID = 'https://18f42c65339d4164b3fdebfc8c8bc99b@sentry.io/1186960';