Save in-progress keysat integration and StartOS 0.4 work
Snapshot of the working tree before cleanup. Captures: - Keysat licensing: server/license.js, /api/license/* endpoints in server/index.js, activation modal in public/index.html, embedded Ed25519 issuer key (assets/issuer.pub). - StartOS 0.4 expansion: setApiKey action, version files v0.1.1 through v0.1.15, file-models/config.json.ts, manifest updates. - Self-hosted registry server (startos-registry/). - Build/deploy scripts (bin/bump-version.sh, bin/deploy.sh, vendored yt-dlp binary), .gitignore, .deploy.env.example. - Recent design docs (KEYSAT_INTEGRATION.md, UPGRADE-DESIGN.md) — retained here so they remain recoverable when removed in the follow-up cleanup commit.
This commit is contained in:
+69
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* unpipe
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = unpipe
|
||||
|
||||
/**
|
||||
* Determine if there are Node.js pipe-like data listeners.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function hasPipeDataListeners(stream) {
|
||||
var listeners = stream.listeners('data')
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
if (listeners[i].name === 'ondata') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpipe a stream from all destinations.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @public
|
||||
*/
|
||||
|
||||
function unpipe(stream) {
|
||||
if (!stream) {
|
||||
throw new TypeError('argument stream is required')
|
||||
}
|
||||
|
||||
if (typeof stream.unpipe === 'function') {
|
||||
// new-style
|
||||
stream.unpipe()
|
||||
return
|
||||
}
|
||||
|
||||
// Node.js 0.8 hack
|
||||
if (!hasPipeDataListeners(stream)) {
|
||||
return
|
||||
}
|
||||
|
||||
var listener
|
||||
var listeners = stream.listeners('close')
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listener = listeners[i]
|
||||
|
||||
if (listener.name !== 'cleanup' && listener.name !== 'onclose') {
|
||||
continue
|
||||
}
|
||||
|
||||
// invoke the listener
|
||||
listener.call(stream)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user