diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..f9796f6 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,8 @@ +{ + "extends": "flying-rocket", + "rules": { + "indent": ["error", 2], + "import/prefer-default-export": 0, + "react/require-default-props": 0 + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..65071cf --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "semi": false, + "tabWidth": 2 +} \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..958a1dd --- /dev/null +++ b/app.js @@ -0,0 +1,35 @@ +import { h } from 'preact' +import axios from 'axios' +// eslint-disable-next-line import/no-extraneous-dependencies +import 'regenerator-runtime/runtime' +import { useEffect, useState } from 'preact/hooks' + +import Video from './src/components/Video' +import config from './src/data/conf.json' + +export default () => { + const [isPlaying, setIsPlaying] = useState(false) + const [videoUrl, setVideoUrl] = useState(null) + + useEffect(() => { + const getData = async () => { + const { data } = await axios.get( + `${config.peertube_root}/api/v1/videos/${config.next_stream.peertube_id}` + ) + console.log(data) + const src = `${config.peertube_root}${data.embedPath}` + console.log('src', src) + setVideoUrl(src) + } + + getData() + }, []) + + return ( +