Skip to content

Instantly share code, notes, and snippets.

View rigelk's full-sized avatar

Rigel Kent rigelk

View GitHub Profile
{
"total": 4,
"data": [
{
"host": "framatube.org"
},
{
"host": "peertube.cpy.re"
},
{
@rigelk
rigelk / spec-mastodon.json
Created September 11, 2019 09:33
Spec test for @w3c-socialcg-aptf/apcomponents
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"owl": "http://www.w3.org/2002/07/owl#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
// Security middleware
app.use(helmet({
frameguard: {
action: 'deny' // we only allow it for /videos/embed, see server/controllers/client.ts
},
hsts: false,
contentSecurityPolicy: {
directives: {
defaultSrc: ['*'], // by default, not specifying default-src = '*'
mediaSrc: ["'self'"],
HotkeyModule.forRoot({
cheatSheetCloseEsc: true,
cheatSheetDescription: this.i18n('Show / hide this help menu')
})
@rigelk
rigelk / utils.ts
Created October 3, 2018 12:16
getVersion
async function getVersion () {
const tag = await require('child_process')
.exec('[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true', { stdio: [0,1,2] })
if (tag) return tag.replace(/^v/, '')
const version = await require('child_process')
.exec('[ ! -d .git ] || git rev-parse --short HEAD')
if (version) return version.toString().trim()
return require('../../../package.json').version
@rigelk
rigelk / diff.patch
Created September 30, 2018 11:18
PeerTube #1135 proposal
diff --git server/helpers/ffmpeg-utils.ts server/helpers/ffmpeg-utils.ts
index ed823a67..92025092 100644
--- server/helpers/ffmpeg-utils.ts
+++ server/helpers/ffmpeg-utils.ts
@@ -116,10 +116,6 @@ type TranscodeOptions = {
function transcode (options: TranscodeOptions) {
return new Promise<void>(async (res, rej) => {
- if (options.resolution === undefined) {
- return rej('Invalid video file')
import {
ComponentFixture,
TestBed
} from '@angular/core/testing'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { RouterTestingModule } from '@angular/router/testing'
import { VideosProvider, VideoService } from '../../shared/video/video.service'
import { VideoUpdateComponent } from '../+video-edit/video-update.component'
import { VideoEditComponent } from '../+video-edit/shared/video-edit.component'
import { VideosModule } from '../videos.module'
@rigelk
rigelk / ffmpeg-utils.ts
Created July 28, 2018 09:25
check streamability
async function isVideoFileStreamable (path: string): Promise<{ [key: string]: boolean }> {
let stream = fs.createReadStream(path, {
encoding: null,
start: 0,
end: 1024 * 1024
})
const isAVC = (await getVideoFileStream(path)).filter(s => {
return s['codec_name'] === 'h264' &&
s['bit_rate'] < 3000000
@rigelk
rigelk / chrooted.sh
Created May 2, 2018 23:13 — forked from andsens/chrooted.sh
Configure server for chrooted sftp users and create those users
#!/bin/bash
# source this file in /root/.bashrc or /root/.zshrc
# Sets up the server for chrooted users
configure_chrooted() {
grep ^chrooted: /etc/group
if [[ $? == 0 ]]; then
printf "The chrooted group already exists, aborting...\n"
exit 1
/*
we check feed validity using:
- XSD for RSS 2.0 -> https://raw.githubusercontent.com/ultraq/rss-xml-generator/master/Schema/RSS-2.0.xsd
- JSON Schema for… JSON Feed -> https://raw.githubusercontent.com/sonicdoe/jsonfeed-schema/master/schema-v1.json
*/
const JSONFeedInstanceJSONSchema = require('jsonfeed-schema')
JSONFeedInstanceJSONSchema.properties.items.items.additionalProperties = true
async function loadXSD (path): Promise<string> {