index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/mutex.ts
/** * A simple mutex that allows coordination of access * to a shared resource. */ export class Mutex { locked = false; queue: (() => void)[] = []; /** * Returns a promisee that resolves with a function that * should be called when access to the resource is complete. */ wait(): Promise<() => void> ...
9,200
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/obs.ts
import * as obs from '../../obs-api'; // Utilities for interacting with OBS /** * This should always be used instead of reading settings * directly from an OBS input. This is because the OBS * settings object does not always contain default values * and is therefore unreliable for reading the actual * current v...
9,201
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/operating-systems.ts
export enum OS { Windows = 'win32', Mac = 'darwin', } type TOSHandlerMap<TReturn> = { [os in OS]: (() => TReturn) | TReturn }; export function byOS<TReturn>(handlers: TOSHandlerMap<TReturn>): TReturn { const handler = handlers[process.platform]; if (typeof handler === 'function') return handler(); return ...
9,202
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/performance.ts
import uuid from 'uuid/v4'; /** * Used to simply measure and log the duration between 2 points in code */ export class Measure { readonly id: string; constructor(public name: string) { this.id = uuid(); this.start(); } get startMark() { return `${this.id}-start`; } get endMark() { retu...
9,203
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/pmap.ts
export interface PmapOptions<TVal, TRet> { concurrency?: number; onProgress?: (completedItem: TVal, returnVal: TRet, nComplete: number) => void; } /** * Allows waiting on a bulk set of computationally expensive async * bulk operations. It behaves similarly to Promise.all, but * allows passing a concurency numbe...
9,204
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/properties-type-guards.ts
import * as obs from '../../obs-api'; export function isNumberProperty(property: obs.IProperty): property is obs.INumberProperty { return property.type === obs.EPropertyType.Int || property.type === obs.EPropertyType.Float; } export function isTextProperty(property: obs.IProperty): property is obs.ITextProperty { ...
9,205
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/rect.ts
import { v2, Vec2 } from './vec2'; /** * Class for a simple rectangle */ export class Rect implements IRectangle { x: number; y: number; width: number; height: number; constructor(options: IRectangle) { this.x = options.x; this.y = options.y; this.width = options.width; this.height = optio...
9,206
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/requests.ts
// Helper methods for making HTTP requests import fs from 'fs'; import crypto from 'crypto'; import humps from 'humps'; /** * Passing this function as your first "then" handler when making * a request using the fetch API will guarantee that non-success * HTTP response codes will result in a rejected promise. Note ...
9,207
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/slow-imports.ts
// the list of libraries that takes > 50ms to be imported // don't use static import for these libs to avoid longer startup time export function importAwsSdk() { return import('aws-sdk'); } export function importExtractZip() { return import('extract-zip'); } export function importArchiver() { return import('ar...
9,208
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/unload.ts
import Utils from 'services/utils'; /** * Helper for registering an action that needs to be performed on window refresh * Does nothing in production for now * @returns a function to cancel the unload operation */ export function onUnload(fun: () => void) { if (!Utils.isDevMode()) return () => {}; window.addEv...
9,209
0
petrpan-code/stream-labs/desktop/app
petrpan-code/stream-labs/desktop/app/util/vec2.ts
import { Vector2 } from '../../vendor/threejs/vector2'; type TVecConstructorArgs = [number, number] | [IVec2] | []; /** * Math for 2d vectors * Use a THREE.Vector2 class as a base class * @see https://threejs.org/docs/#api/en/math/Vector2 */ export class Vec2 extends Vector2 { constructor(...args: TVecConstruct...
9,210
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/BlendingMethodMenu.ts
import { Menu } from './Menu'; import { Inject } from 'services/core/injector'; import { $t } from 'services/i18n'; import { SelectionService } from 'services/selection'; import { EditorCommandsService } from 'services/editor-commands'; import { EBlendingMethod } from 'services/scenes'; export class BlendingMethodMenu...
9,211
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/BlendingModeMenu.ts
import { Menu } from './Menu'; import { Inject } from 'services/core/injector'; import { $t } from 'services/i18n'; import { SelectionService } from 'services/selection'; import { EditorCommandsService } from 'services/editor-commands'; import { EBlendingMode } from 'services/scenes'; export class BlendingModeMenu ext...
9,212
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/DeinterlacingModeMenu.ts
import { Menu } from './Menu'; import { Inject } from 'services/core/injector'; import { $t } from 'services/i18n'; import { SelectionService } from 'services/selection'; import { EditorCommandsService } from 'services/editor-commands'; import { EDeinterlaceMode, EDeinterlaceFieldOrder } from 'services/sources'; expor...
9,213
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/EditMenu.ts
import { Inject } from '../../services/core/injector'; import { Menu } from './Menu'; import { Source, SourcesService } from '../../services/sources'; import { SceneItem, ScenesService, isItem } from '../../services/scenes'; import { ClipboardService } from 'services/clipboard'; import { SourceTransformMenu } from './S...
9,214
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/FiltersMenu.ts
import { Menu } from './Menu'; import { Inject } from '../../services/core/injector'; import { $t } from 'services/i18n'; import { SourceFiltersService } from 'services/source-filters'; import { ClipboardService } from 'services/clipboard'; export class FiltersMenu extends Menu { @Inject() private sourceFiltersServi...
9,215
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/GroupMenu.ts
import { Menu } from './Menu'; import { ScenesService } from 'services/scenes'; import { SelectionService } from 'services/selection'; import { Inject } from '../../services/core/injector'; import { $t } from 'services/i18n'; import { EditorCommandsService } from 'services/editor-commands'; export class GroupMenu exte...
9,216
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/Menu.ts
// An abstraction on electron Menus import * as remote from '@electron/remote'; export class Menu { menu: Electron.Menu; constructor() { this.menu = new remote.Menu(); } popup(opts?: { window: Electron.BrowserWindow; x: number; y: number }) { if (opts) { this.menu.popup(opts); } else { ...
9,217
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/ProjectorMenu.ts
import { Menu } from './Menu'; import { Inject } from '../../services/core/injector'; import { $t } from 'services/i18n'; import { ProjectorService } from 'services/projector'; import { ERenderingMode } from '../../../obs-api'; import { StreamingService } from 'services/streaming'; import { SelectionService } from 'ser...
9,218
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/ScaleFilteringMenu.ts
import { Menu } from './Menu'; import { Inject } from 'services/core/injector'; import { $t } from 'services/i18n'; import { SelectionService } from 'services/selection'; import { EditorCommandsService } from 'services/editor-commands'; import { EScaleType } from 'services/scenes'; export class ScaleFilteringMenu exte...
9,219
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/menus/SourceTransformMenu.ts
import { Menu } from './Menu'; import { SelectionService } from 'services/selection'; import { Inject } from 'services/core/injector'; import { $t } from 'services/i18n'; import { EditorCommandsService } from 'services/editor-commands'; import { ECenteringType } from 'services/editor-commands/commands/center-items'; im...
9,220
0
petrpan-code/stream-labs/desktop/app/util
petrpan-code/stream-labs/desktop/app/util/webgl/utils.ts
// Adapted from https://webglfundamentals.org/webgl/lessons/webgl-boilerplate.html /** * Creates and compiles a shader. * * @param gl The WebGL Context. * @param shaderSource The GLSL source code for the shader. * @param shaderType The type of shader, VERTEX_SHADER or * FRAGMENT_SHADER. * @return {!WebGLSha...
9,221
0
petrpan-code/stream-labs/desktop/app/util/webgl
petrpan-code/stream-labs/desktop/app/util/webgl/shaders/volmeter.frag
precision mediump float; // Current volume level from 0 to 1 uniform float u_volume; // Current peak hold level: // x: Volume level from 0 to 1 // y: Indicator width from 0 to 1 uniform vec2 u_peakHold; // Minimum thresholds from 0 to 1 uniform float u_warning; uniform float u_danger; // Colors uniform vec3 u_green...
9,222
0
petrpan-code/stream-labs/desktop/app/util/webgl
petrpan-code/stream-labs/desktop/app/util/webgl/shaders/volmeter.vert
attribute vec2 a_position; uniform vec2 u_resolution; uniform vec2 u_translation; uniform vec2 u_scale; varying vec2 v_position; void main() { // Get the position in unit space vec2 position = (a_position * u_scale + u_translation) / u_resolution; // Use this position in the fragment shader v_position = pos...
9,223
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/bin/tail-obs-logs.js
const sh = require('shelljs'); const logDir = '~/AppData/Roaming/slobs-client/node-obs/logs'; let tail; let currentLog; setInterval(() => { const logs = sh.ls(logDir); const lastLog = logs[logs.length - 1]; if (lastLog !== currentLog) { if (tail) { tail.kill(); } console.log('===============...
9,224
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/docs/README.md
# API reference Streamlabs-OBS allows remote management of the application via an RPC-based API. The API is split into several different services. You can access services' methods and properties by sending [JSON-RPC](http://www.jsonrpc.org/specification) messages to the named pipe `slobs`. Individual JSON-RPC request...
9,225
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/docs/how_to_update_fork.md
# To update our forks electron version. ## Prepare electron source Get source and update it with commands ``` git clone https://github.com/stream-labs/electron.git cd electron git checkout sl_2-0-x git remote add upstream https://github.com/electron/electron.git git fetch upstream git merge upstream/2-0-x git push...
9,226
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/docs/typedoc-monkeypatch.js
/** * This script adds some customization code for the typedoc generated documentation */ document.addEventListener('DOMContentLoaded', () => { // simplify the generated page by removing useless html blocks // constructors are useless for API docs removeConstructors(); // hide file exports from navigatio...
9,227
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/electron-builder/afterPack.js
const cp = require('child_process'); const fs = require('fs'); const path = require('path'); function signAndCheck(filePath) { console.log(`Signing: ${filePath}`); cp.execSync(`codesign -fs "Developer ID Application: Streamlabs LLC (UT675MBB9Q)" "${filePath}"`); // All files need to be writable for update to su...
9,228
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/electron-builder/base.config.js
const signtool = require('signtool'); const base = { appId: 'com.streamlabs.slobs', productName: 'Streamlabs Desktop', icon: 'media/images/icon.ico', files: [ 'bundles', '!bundles/*.js.map', 'node_modules', 'vendor', 'app/i18n', 'media/images/game-capture', 'updater/build/bootstrap....
9,229
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/electron-builder/entitlements.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> <key>com.apple.security.device.audio-input</key> <true/> ...
9,230
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/electron-builder/notarize.js
const { notarize } = require('electron-notarize'); const fs = require('fs'); exports.default = async function notarizing(context) { if (process.env.SLOBS_NO_NOTARIZE) return; if (process.platform !== 'darwin') return; const appName = context.packager.appInfo.productFilename; const appPath = `${context.appOutD...
9,231
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/electron-builder/preview.config.js
const base = require('./base.config'); base.appId = 'com.streamlabs.slobspreview'; base.productName = 'Streamlabs Desktop Preview'; base.extraMetadata.name = 'slobs-client-preview'; base.win.extraFiles.push({ from: 'scripts/debug-launcher.bat', to: 'Streamlabs Desktop Preview Debug Mode.bat', }); base.win.executab...
9,232
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/guest-api/index.ts
/** * This script is injected into guest webviews and used by the app * to expose small pieces of functionality based on the guest content. */ import electron from 'electron'; import uuid from 'uuid/v4'; import fs from 'fs'; import util from 'util'; import mime from 'mime'; import path from 'path'; import * as remo...
9,233
0
petrpan-code/stream-labs/desktop/media
petrpan-code/stream-labs/desktop/media/images/loader.svg
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff"> <g fill="none" fill-rule="evenodd"> <g transform="translate(1 1)" stroke-width="2"> <circle stroke-opacity=".5" cx="18" cy="18" r="18"...
9,234
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/obs-api/index.js
'use strict'; exports.__esModule = true; const obs = window['require']('obs-studio-node'); /* Use for...in operator to perfectly mirror the osn module */ for (const entry in obs) { const url = new URL(window.location.href); if (url.searchParams.get('windowId') === 'worker') { exports[entry] = obs[entry]; }...
9,235
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/obs-api/obs-api.d.ts
export * from 'obs-studio-node/module';
9,236
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/obs-api/package.json
{ "main": "index.js", "types": "obs-api.d.ts" }
9,237
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/debug-launcher.bat
SET SLOBS_PRODUCTION_DEBUG=true START "Debug Output" CMD /C "%~dp0Streamlabs OBS Preview.exe"
9,238
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/github-client.js
const { App } = require("@octokit/app"); const { request } = require("@octokit/request"); /** * A wrapper for the Github API */ module.exports.GithubClient = class GithubClient { constructor (appId, privateKey, owner, repo) { this.appId = appId; this.owner = owner; this.repo = repo; this.privateKe...
9,239
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/install-native-deps.js
const sh = require('shelljs'); const colors = require('colors/safe'); const fs = require('fs'); const os = require('os'); const path = require('path'); const stream = require('stream'); const node_modules = path.join(process.cwd(), 'node_modules'); const fetch = require('node-fetch'); function log_info(msg) { sh.e...
9,240
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/postinstall.js
const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); const rimraf = require('rimraf'); // install native deps execSync('node ./scripts/install-native-deps.js', { stdio: [0, 1, 2] }); // the antd library doesn't work with webpack5 // @see https://github.com/ant-design/...
9,241
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/react-progress.js
/** * show the progress of react migration */ const glob = require('glob'); const migratedFiles = glob .sync('app/components-react/**/*.ts') .concat(glob.sync('app/components-react/**/*.tsx')); const allFiles = glob.sync('app/components/**/*.ts').concat(glob.sync('app/components/**/*.tsx')); const duplicatedFi...
9,242
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/repositories.json
{ "root": [ { "name": "obs-studio-node", "url": "https://s3-us-west-2.amazonaws.com/obsstudionodes3.streamlabs.com/", "archive": "osn-[VERSION]-release-[OS][ARCH].tar.gz", "version": "0.23.107", "win64": true, "osx": true }, { "name": "node-libuiohook", "url...
9,243
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/search-untranslated.js
/** * Run this script to find the strings that missed in localization dictionaries. */ const searchExp = /\$t\(([\'\`\"])([ a-zA-Z\d\-_`@%;:,'’=&!~#\\\+\*\?\.\}\{\(\)\[\]\$\<\>/]+?)\1\)/gm; const fs = require('fs'); const recursive = require('recursive-readdir'); (async function main() { const dictionary = {}; ...
9,244
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/scripts/strict-null-progress.js
/** * show the progress of strict-null migration */ const fs = require('fs'); const glob = require('glob'); // read all files eligible for the strictNulls checking const filesPath = 'strict-null-check-files'; const files = fs.readdirSync(filesPath); const migratedFilesPatterns = []; files.forEach(file => { const j...
9,245
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/install.ps1
# Run this script as administrator to setup enviroment on new CI machine: # powershell install.ps1 your_azure_token host_user host_password agent_pool? $token=$args[0] $username=$args[1] $password=$args[2] $pool=$args[3] if (-Not($token) -Or -Not($username) -Or -Not($password)) { echo "Provide a token, system user ...
9,246
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/register-agent.ps1
# register/unregister agent in Azure Pipelines $command=$args[0] if ($command -and ($command -ne 'remove')) { echo "Unknown command $command. Did you mean remove?"; exit -1; } $token=[System.Environment]::GetEnvironmentVariable('AZURE_PIPELINES_TOKEN', [System.EnvironmentVariableTarget]::User) $workingDir=[Sy...
9,247
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/remove-offline-agents.js
/** * Run this script to delete offline agents */ const https = require('https'); const getJSON = (url, options) => { return new Promise((resolve, reject) => { console.log('rest::getJSON'); let output = ''; const req = https.request(url, options, res => { console.log(`status: ${res.statusCode}`...
9,248
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/shutdown.ps1
# run this file on windows shutdown cd $PSScriptRoot; # unregister agent Start-Process -NoNewWindow -Wait "powershell" -ArgumentList "./register-agent.ps1", "remove"
9,249
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/start-agent.ps1
# start agent $workingDir=[System.Environment]::GetEnvironmentVariable('AZURE_PIPELINES_WORKING_DIR', [System.EnvironmentVariableTarget]::User); if (-Not($workingDir)) { echo "Working dir is not set. Did you run the installation script?"; exit -1; } Start-Process -NoNewWindow -Wait -FilePath "$workingDir\run.cmd" ...
9,250
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/startup.ps1
# run this file on windows startup cd $PSScriptRoot; # remove offline agents Start-Process -NoNewWindow -Wait "node" -ArgumentList "./remove-offline-agents.js" # register agent ."./register-agent.ps1"; # start agent and run one job ."./start-agent.ps1"; # unregister agent Start-Process -NoNewWindow -Wait "powershe...
9,251
0
petrpan-code/stream-labs/desktop/scripts
petrpan-code/stream-labs/desktop/scripts/ci/uninstall.ps1
# remove scripts from autostartup $regPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run"; $RegKey = (Get-ItemProperty $regPath); $RegKey.PSObject.Properties | ForEach-Object { If(-Not($_.Name -like 'PS*') -And ($_.Name -ne 'SecurityHealth')){ Write-Host "Remove Value" $_.Name ' = ' $_.Value Remove-...
9,252
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/shared-resources/README
This directory is for resources that need to be accessed by both the Frontend and Backend. Use app/util/get-shared-resource.ts to get a fully qualified path to a shared resource.
9,253
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/chat.json
{ "ts": [ "app/services/chat.ts" ], "tsx": [ ] }
9,254
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/core.json
{ "ts": [ "app/services/core/*.ts" ], "tsx": [ ] }
9,255
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/highlighter.json
{ "ts": [ "app/services/highlighter/*.ts" ], "tsx": [ ] }
9,256
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/hotekys.json
{ "ts": [ "app/services/hotkeys.ts" ], "tsx": [ ] }
9,257
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/onboarding.json
{ "ts": [], "tsx": ["app/components/pages/onboarding-steps/PrimeExpiration.tsx"] }
9,258
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/platforms.json
{ "ts": [ "app/services/platforms/**/*.ts" ], "tsx": [ ] }
9,259
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/scene-collections.json
{ "ts": [ "app/services/scene-collections/*.ts" ], "tsx": [ ] }
9,260
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/sources.json
{ "ts": [ "app/services/sources/*.ts", "app/services/scenes/*.ts" ], "tsx": [ ] }
9,261
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/strict-null-check-files/streaming.json
{ "ts": [ "app/services/streaming/*.ts", "app/services/settings/streaming/*.ts" ], "tsx": [ "app/components/windows/go-live/*.ts" ] }
9,262
0
petrpan-code/stream-labs/desktop
petrpan-code/stream-labs/desktop/test/tsconfig.json
{ "compilerOptions": { "outDir": "../test-dist", "target": "es6", "lib": [ "dom", "es7", "es2017" ], "module": "commonjs", "sourceMap": true, "allowJs": true, "noImplicitAny": true, "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "noI...
9,263
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/data/scene-collection-manifest.json
{ "activeId": "4e467470-923c-43a3-90d2-2be39c8c34ee", "collections": [ { "id": "4e467470-923c-43a3-90d2-2be39c8c34ee", "name": "Neon City", "deleted": false, "modified": "2018-05-22T19:20:08.109Z", "needsRename": false } ] }
9,264
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/data/scene-collection.json
{ "schemaVersion": 1, "nodeType": "RootNode", "sources": { "schemaVersion": 3, "nodeType": "SourcesNode", "items": [ { "id": "ffmpeg_source_77d1498e-98b4-4075-affb-476c42321aa0", "name": "Stream Starting Soon", "type": "ffmpeg_source", "settings": { "buf...
9,265
0
petrpan-code/stream-labs/desktop/test/data/sources-files
petrpan-code/stream-labs/desktop/test/data/sources-files/html/hello.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <h1>Hello word!</h1> </body> </html>
9,266
0
petrpan-code/stream-labs/desktop/test/data/sources-files
petrpan-code/stream-labs/desktop/test/data/sources-files/text/hello.txt
Hello world!
9,267
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/api-client.ts
import { IJsonRpcEvent, IJsonRpcRequest, IJsonRpcResponse } from '../../app/services/api/jsonrpc'; import { Observable, Subject, Subscription } from 'rxjs'; import { first } from 'rxjs/operators'; import { isEqual } from 'lodash'; const net = require('net'); const { spawnSync } = require('child_process'); const snp = ...
9,268
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/cmd-client.ts
/** * This code allows to execute API requests from a terminal. * Tests run this code in separated process via `spawnSync` to emulate the synchronous nature of our API. * If this solution will become too slow we can use for example synchronous http/ajax requests instead. * @example * node cmd-client.js ScenesServi...
9,269
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/form-monkey.ts
import { sleep } from './sleep'; import { cloneDeep, isMatch } from 'lodash'; import { TExecutionContext } from './webdriver'; import { click } from './modules/core'; interface IUIInput { type: string; name: string; title: string; selector: string; loading: boolean; } type FNValueSetter = (form: FormMonkey,...
9,270
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/repo.js
const fs = require('fs-extra'); const path = require('path'); const { execSync } = require('child_process'); const { CI } = process.env; /** * exec sync and redirect output to stdio */ function exec(cmd) { console.log('RUN', cmd); return execSync(cmd, { stdio: [0, 1, 1] }); } /** * fetching the commit SHA */...
9,271
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/runner.js
/** * Tests runner script: * - fetch average test timings from the DB * - run tests * - if some tests failed retry only these tests * - save failed tests to DB */ const jobStartTime = Date.now(); const { execSync } = require('child_process'); const fs = require('fs'); const rimraf = require('rimraf'); const fetch...
9,272
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/scene-builder.ts
import { ApiClient } from './api-client'; import { ScenesService, Scene, TSceneNodeType, SceneItem, SceneNode, } from '../../app/services/api/external-api/scenes'; import { TSourceType } from '../../app/services/sources'; interface ISceneBuilderNode { name: string; type: 'item' | 'folder'; sourceType?:...
9,273
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/sleep.js
// Useful for debugging. // If you think you need to use this in an actual // test, you almost definitely don't. export function sleep(ms, countdown = false) { function countdownTick(ms) { if (ms < 0) return; console.log('sleep', ms); setTimeout(() => countdownTick(ms - 1000), 1000); } if (countdown)...
9,274
0
petrpan-code/stream-labs/desktop/test
petrpan-code/stream-labs/desktop/test/helpers/widget-helpers.ts
import { sleep } from './sleep'; import { TExecutionContext } from './webdriver'; import { WidgetsService, WidgetType } from '../../app/services/widgets'; import { SourcesService } from '../../app/services/sources'; import { getApiClient } from './api-client'; import { focusChild } from './modules/core'; export async ...
9,275
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/core.ts
/* * The core module provides methods for the most frequent actions */ import { getContext } from '../webdriver'; import { getApiClient } from '../api-client'; import { WindowsService } from '../../../app/services/windows'; import { ClickOptions, WaitForOptions } from 'webdriverio'; export type TSelectorOrEl = stri...
9,276
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/dual-output.ts
import { focusChild, click, clickCheckbox, clickButton, clickIfDisplayed } from './core'; import { showSettingsWindow } from './settings/settings'; /** * Toggle dual output mode */ export async function toggleDualOutputMode(closeChildWindow: boolean = true) { await showSettingsWindow('Video', async () => { awa...
9,277
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/filters.ts
// Source helper functions import { rightClickSource } from './sources'; import { contextMenuClick } from '../webdriver/context-menu'; import { click, clickButton, focusChild, focusMain, select } from './core'; import { useForm } from './forms'; export async function openFiltersWindow(sourceName: string) { await foc...
9,278
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/navigation.ts
import { click, focusMain } from './core'; export async function showPage(page: string) { await focusMain(); await click(`.side-nav div[title="${page}"]`); }
9,279
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/onboarding.ts
import { click, clickButton, clickIfDisplayed, isDisplayed, useMainWindow } from './core'; export async function skipOnboarding() { await useMainWindow(async () => { if (!(await isDisplayed('h2=Live Streaming'))) return; await click('h2=Live Streaming'); await click('button=Continue'); await click('s...
9,280
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/replay-buffer.ts
import { click, useMainWindow, waitForDisplayed } from './core'; import {sleep} from "../sleep"; export async function startReplayBuffer() { await useMainWindow(async () => { await click('button .icon-replay-buffer'); await waitForDisplayed('button .fa.fa-stop'); }); } export async function saveReplayBuff...
9,281
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/scenes.ts
// Scene helper functions import { contextMenuClick } from '../webdriver/context-menu'; import { dialogDismiss } from '../webdriver/dialog'; import { click, clickButton, focusChild, focusMain, select, waitForLoader } from './core'; import { sleep } from '../sleep'; import { useForm } from './forms'; async function cli...
9,282
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/sources.ts
// Source helper functions import { focusMain, focusChild, closeWindow, click, clickButton, isDisplayed, select, waitForDisplayed, } from './core'; import { setInputValue } from './forms/form'; import { dialogDismiss } from '../webdriver/dialog'; import { contextMenuClick } from '../webdriver/context-me...
9,283
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/streaming.ts
/* * The streaming module provides helper-methods for everything related to * starting, scheduling, and updating streams */ import { getApiClient } from '../api-client'; import { click, clickButton, focusChild, getFocusedWindowId, isDisplayed, select, selectButton, useChildWindow, useMainWindow, w...
9,284
0
petrpan-code/stream-labs/desktop/test/helpers
petrpan-code/stream-labs/desktop/test/helpers/modules/user.ts
import { getContext } from '../webdriver'; import { TPlatform } from '../../../app/services/platforms'; import { ITestUserFeatures, logIn as userLogin } from '../webdriver/user'; export function logIn( platform: TPlatform = 'twitch', features?: ITestUserFeatures, // if not set, pick a random user's account from us...
9,285
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/api/scenes.ts
import { getApiClient } from '../../api-client'; import { SceneCollectionsService } from '../../../../app/services/api/external-api/scene-collections'; /** * Create an new empty collection and delete other collections via API * Helps to speed up some tests */ export async function clearCollections() { const api =...
9,286
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/base.ts
import { getClient, select, TSelectorOrEl } from '../core'; import { sleep } from '../../sleep'; /** * A base class for all input controllers */ export abstract class BaseInputController<TValue> { protected client: WebdriverIO.Browser; constructor(private selectorOrEl: TSelectorOrEl, public name: string) {} ...
9,287
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/bool-button.ts
import { SwitchInputController } from './switch'; export class BoolButtonInputController extends SwitchInputController { async getValue() { const $el = await this.getElement(); return (await $el.getAttribute('data-value')) === 'true'; } }
9,288
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/checkbox.ts
import { SwitchInputController } from './switch'; export class CheckboxInputController extends SwitchInputController {}
9,289
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/file.ts
import { BaseInputController } from './base'; import { click } from '../core'; import { dialogSelectPath } from '../../webdriver/dialog'; export class FileInputController extends BaseInputController<string> { async setValue(filePath: string) { const $el = await this.getElement(); const $browseBtn = await (aw...
9,290
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/form.ts
import * as inputControllers from './inputs'; import { BaseInputController, TFiledSetterFn } from './base'; import { pascalize } from 'humps'; import { difference, keyBy, isEqual, mapValues } from 'lodash'; import { getClient, waitForDisplayed } from '../core'; import { sleep } from '../../sleep'; const DEFAULT_FORM_S...
9,291
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/index.ts
export * from './form';
9,292
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/inputs.ts
export { TextInputController } from './text'; export { NumberInputController } from './number'; export { TextareaInputController } from './textarea'; export { ListInputController } from './list'; export { TagsInputController } from './tags'; export { SwitchInputController } from './switch'; export { CheckboxInputContro...
9,293
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/list.ts
import { BaseInputController, TFiledSetterFn } from './base'; import { click, getClient, select } from '../core'; import { sleep } from '../../sleep'; export class ListInputController<TValue> extends BaseInputController<TValue> { async setValue(value: TValue) { // open dropdown await this.open(); await t...
9,294
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/number.ts
import { TextInputController } from './text'; export class NumberInputController extends TextInputController {}
9,295
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/slider.ts
import { BaseInputController } from './base'; import { sleep } from '../../sleep'; import { getClient } from '../core'; export class SliderInputController extends BaseInputController<number> { async setValue(value: number) { const goalValue = Number(value); const client = getClient(); const $el = await t...
9,296
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/switch.ts
import { BaseInputController } from './base'; export class SwitchInputController extends BaseInputController<boolean> { async setValue(value: boolean) { const $el = await this.getElement(); const currentValue = await this.getValue(); if (currentValue !== value) { await $el.waitForEnabled(); a...
9,297
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/tags.ts
import { BaseInputController } from './base'; import { clickIfDisplayed, select } from '../core'; import { sleep } from '../../sleep'; export class TagsInputController extends BaseInputController<(string | number)[]> { async setValue(values: (string | number)[]) { return this.setValuesWith('value', values); } ...
9,298
0
petrpan-code/stream-labs/desktop/test/helpers/modules
petrpan-code/stream-labs/desktop/test/helpers/modules/forms/text.ts
import { BaseInputController, setInputValue } from './base'; export class TextInputController extends BaseInputController<string> { async setValue(value: string) { const el = await this.getElement(); await setInputValue(el, value); } async getValue() { const el = await this.getElement(); return ...
9,299