mirror of https://github.com/Chocobozzz/PeerTube
Merge branch 'release/1.4.0' into develop
commit
ee7ea34e62
|
@ -3,13 +3,13 @@ image: chocobozzz/peertube-ci:10
|
||||||
stages:
|
stages:
|
||||||
- build-and-lint
|
- build-and-lint
|
||||||
- test
|
- test
|
||||||
- nightly
|
- docker-nightly
|
||||||
|
|
||||||
before_script:
|
#before_script:
|
||||||
- 'sed -i -z "s/database:\n hostname: ''localhost''/database:\n hostname: ''postgres''/" config/test.yaml'
|
# - 'sed -i -z "s/database:\n hostname: ''localhost''/database:\n hostname: ''postgres''/" config/test.yaml'
|
||||||
- 'sed -i -z "s/redis:\n hostname: ''localhost''/redis:\n hostname: ''redis''/" config/test.yaml'
|
# - 'sed -i -z "s/redis:\n hostname: ''localhost''/redis:\n hostname: ''redis''/" config/test.yaml'
|
||||||
- if [[ $CI_JOB_STAGE == "test" ]]; then psql -c "create user peertube with password 'peertube';"; fi
|
# - if [[ $CI_JOB_STAGE == "test" ]]; then psql -c "create user peertube with password 'peertube';"; fi
|
||||||
- NOCLIENT=1 yarn install --pure-lockfile --cache-folder .yarn-cache
|
# - NOCLIENT=1 yarn install --pure-lockfile --cache-folder .yarn-cache
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
key: yarn
|
key: yarn
|
||||||
|
@ -85,7 +85,7 @@ cache:
|
||||||
# - NODE_PENDING_JOB_WAIT=1000 npm run ci -- api-$CI_NODE_INDEX
|
# - NODE_PENDING_JOB_WAIT=1000 npm run ci -- api-$CI_NODE_INDEX
|
||||||
|
|
||||||
build-nightly:
|
build-nightly:
|
||||||
stage: nightly
|
stage: docker-nightly
|
||||||
only:
|
only:
|
||||||
- schedules
|
- schedules
|
||||||
script:
|
script:
|
||||||
|
@ -98,3 +98,27 @@ build-nightly:
|
||||||
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi
|
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi
|
||||||
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi
|
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi
|
||||||
|
|
||||||
|
.docker: &docker
|
||||||
|
stage: docker-nightly
|
||||||
|
image:
|
||||||
|
name: gcr.io/kaniko-project/executor:debug
|
||||||
|
entrypoint: [""]
|
||||||
|
before_script:
|
||||||
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > /kaniko/.docker/config.json
|
||||||
|
script:
|
||||||
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/support/docker/production/Dockerfile.stretch --destination $DOCKER_IMAGE_NAME
|
||||||
|
|
||||||
|
build-docker-develop:
|
||||||
|
<<: *docker
|
||||||
|
only:
|
||||||
|
- schedules
|
||||||
|
- develop
|
||||||
|
variables:
|
||||||
|
DOCKER_IMAGE_NAME: chocobozzz/peertube:develop-stretch
|
||||||
|
|
||||||
|
build-docker-tag:
|
||||||
|
<<: *docker
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
variables:
|
||||||
|
DOCKER_IMAGE_NAME: chocobozzz/peertube:$CI_COMMIT_TAG-stretch
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { PublicServerSetting } from '@shared/models/plugins/public-server.settin
|
||||||
import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
|
import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
|
||||||
import { RegisterClientHelpers } from '../../../types/register-client-option.model'
|
import { RegisterClientHelpers } from '../../../types/register-client-option.model'
|
||||||
import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model'
|
import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model'
|
||||||
|
import { importModule } from '@app/shared/misc/utils'
|
||||||
|
|
||||||
interface HookStructValue extends RegisterClientHookOptions {
|
interface HookStructValue extends RegisterClientHookOptions {
|
||||||
plugin: ServerConfigPlugin
|
plugin: ServerConfigPlugin
|
||||||
|
@ -222,7 +223,7 @@ export class PluginService implements ClientHook {
|
||||||
console.log('Loading script %s of plugin %s.', clientScript.script, plugin.name)
|
console.log('Loading script %s of plugin %s.', clientScript.script, plugin.name)
|
||||||
|
|
||||||
return this.zone.runOutsideAngular(() => {
|
return this.zone.runOutsideAngular(() => {
|
||||||
return import(/* webpackIgnore: true */ clientScript.script)
|
return importModule(clientScript.script)
|
||||||
.then((script: ClientScriptModule) => script.register({ registerHook, peertubeHelpers }))
|
.then((script: ClientScriptModule) => script.register({ registerHook, peertubeHelpers }))
|
||||||
.then(() => this.sortHooksByPriority())
|
.then(() => this.sortHooksByPriority())
|
||||||
.catch(err => console.error('Cannot import or register plugin %s.', pluginInfo.plugin.name, err))
|
.catch(err => console.error('Cannot import or register plugin %s.', pluginInfo.plugin.name, err))
|
||||||
|
|
|
@ -134,6 +134,41 @@ function scrollToTop () {
|
||||||
window.scroll(0, 0)
|
window.scroll(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Thanks: https://github.com/uupaa/dynamic-import-polyfill
|
||||||
|
function importModule (path: string) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const vector = '$importModule$' + Math.random().toString(32).slice(2)
|
||||||
|
const script = document.createElement('script')
|
||||||
|
|
||||||
|
const destructor = () => {
|
||||||
|
delete window[ vector ]
|
||||||
|
script.onerror = null
|
||||||
|
script.onload = null
|
||||||
|
script.remove()
|
||||||
|
URL.revokeObjectURL(script.src)
|
||||||
|
script.src = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
script.defer = true
|
||||||
|
script.type = 'module'
|
||||||
|
|
||||||
|
script.onerror = () => {
|
||||||
|
reject(new Error(`Failed to import: ${path}`))
|
||||||
|
destructor()
|
||||||
|
}
|
||||||
|
script.onload = () => {
|
||||||
|
resolve(window[ vector ])
|
||||||
|
destructor()
|
||||||
|
}
|
||||||
|
const absURL = (environment.apiUrl || window.location.origin) + path
|
||||||
|
const loader = `import * as m from "${absURL}"; window.${vector} = m;` // export Module
|
||||||
|
const blob = new Blob([ loader ], { type: 'text/javascript' })
|
||||||
|
script.src = URL.createObjectURL(blob)
|
||||||
|
|
||||||
|
document.head.appendChild(script)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
sortBy,
|
sortBy,
|
||||||
durationToString,
|
durationToString,
|
||||||
|
@ -147,5 +182,6 @@ export {
|
||||||
objectToFormData,
|
objectToFormData,
|
||||||
objectLineFeedToHtml,
|
objectLineFeedToHtml,
|
||||||
removeElementFromArray,
|
removeElementFromArray,
|
||||||
|
importModule,
|
||||||
scrollToTop
|
scrollToTop
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue