Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 61891839d9 | |||
|
|
17cd2d54d0 | ||
| 9b61436a05 | |||
| 31e3cfab24 | |||
| ed437ec367 | |||
|
|
92aabc0086 | ||
| 38a0cedc9c | |||
| c0c2fcb009 | |||
| 3edebbdb6c | |||
|
|
98f0ea3bd2 | ||
| 0daf36719b | |||
| 38683bfe85 | |||
| 4066a6d5e3 | |||
| ee18929196 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ ui/
|
|||||||
frontend/.pnp.cjs
|
frontend/.pnp.cjs
|
||||||
frontend/.pnp.loader.mjs
|
frontend/.pnp.loader.mjs
|
||||||
frontend/.yarn/install-state.gz
|
frontend/.yarn/install-state.gz
|
||||||
|
.db.lock
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o yt-dlp-webui
|
|||||||
FROM alpine:edge
|
FROM alpine:edge
|
||||||
|
|
||||||
RUN apk update && \
|
RUN apk update && \
|
||||||
apk add ffmpeg yt-dlp ca-certificates curl wget
|
apk add ffmpeg yt-dlp ca-certificates curl wget psmisc
|
||||||
|
|
||||||
VOLUME /downloads /config
|
VOLUME /downloads /config
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ services:
|
|||||||
- 3033:3033
|
- 3033:3033
|
||||||
volumes:
|
volumes:
|
||||||
- <your dir>:/downloads # replace <your dir> with a directory on your host system
|
- <your dir>:/downloads # replace <your dir> with a directory on your host system
|
||||||
|
- <your dir>:/config # directory where config.yml will be stored
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl -f http://localhost:3033 || exit 1
|
test: curl -f http://localhost:3033 || exit 1
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yt-dlp-webui",
|
"name": "yt-dlp-webui",
|
||||||
"version": "3.0.9",
|
"version": "3.1.0",
|
||||||
"description": "Frontend compontent of yt-dlp-webui",
|
"description": "Frontend compontent of yt-dlp-webui",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ languages:
|
|||||||
filenameOverrideOption: Enable output file name overriding
|
filenameOverrideOption: Enable output file name overriding
|
||||||
customFilename: Custom filemame (leave blank to use default)
|
customFilename: Custom filemame (leave blank to use default)
|
||||||
customPath: Custom path
|
customPath: Custom path
|
||||||
customArgs: Enable custom yt-dlp args (great power = great responsabilities)
|
customArgs: Enable custom yt-dlp args (great power = great responsibilities)
|
||||||
customArgsInput: Custom yt-dlp arguments
|
customArgsInput: Custom yt-dlp arguments
|
||||||
rpcConnErr: Error while conencting to RPC server
|
rpcConnErr: Error while conencting to RPC server
|
||||||
splashText: No active downloads
|
splashText: No active downloads
|
||||||
@@ -53,6 +53,7 @@ languages:
|
|||||||
bulkDownload: 'Download files in a zip archive'
|
bulkDownload: 'Download files in a zip archive'
|
||||||
rpcPollingTimeTitle: RPC polling time
|
rpcPollingTimeTitle: RPC polling time
|
||||||
rpcPollingTimeDescription: A lower interval results in higher CPU usage (server and client side)
|
rpcPollingTimeDescription: A lower interval results in higher CPU usage (server and client side)
|
||||||
|
templatesReloadInfo: To register a new template it might need a page reload.
|
||||||
german:
|
german:
|
||||||
urlInput: Video URL
|
urlInput: Video URL
|
||||||
statusTitle: Status
|
statusTitle: Status
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ const DownloadDialog: FC<Props> = ({ open, onClose, onDownloadStart }) => {
|
|||||||
* Retrive url from input and display the formats selection view
|
* Retrive url from input and display the formats selection view
|
||||||
*/
|
*/
|
||||||
const sendUrlFormatSelection = () => {
|
const sendUrlFormatSelection = () => {
|
||||||
setUrl('')
|
|
||||||
setPickedAudioFormat('')
|
setPickedAudioFormat('')
|
||||||
setPickedVideoFormat('')
|
setPickedVideoFormat('')
|
||||||
setPickedBestFormat('')
|
setPickedBestFormat('')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRecoilState, useRecoilValue } from 'recoil'
|
|||||||
import { loadingDownloadsState } from '../atoms/downloads'
|
import { loadingDownloadsState } from '../atoms/downloads'
|
||||||
import { listViewState } from '../atoms/settings'
|
import { listViewState } from '../atoms/settings'
|
||||||
import { loadingAtom } from '../atoms/ui'
|
import { loadingAtom } from '../atoms/ui'
|
||||||
import DownloadsCardView from './DownloadsCardView'
|
import DownloadsGridView from './DownloadsGridView'
|
||||||
import DownloadsTableView from './DownloadsTableView'
|
import DownloadsTableView from './DownloadsTableView'
|
||||||
|
|
||||||
const Downloads: React.FC = () => {
|
const Downloads: React.FC = () => {
|
||||||
@@ -21,7 +21,7 @@ const Downloads: React.FC = () => {
|
|||||||
|
|
||||||
if (tableView) return <DownloadsTableView />
|
if (tableView) return <DownloadsTableView />
|
||||||
|
|
||||||
return <DownloadsCardView />
|
return <DownloadsGridView />
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Downloads
|
export default Downloads
|
||||||
@@ -4,16 +4,19 @@ import { activeDownloadsState } from '../atoms/downloads'
|
|||||||
import { useToast } from '../hooks/toast'
|
import { useToast } from '../hooks/toast'
|
||||||
import { useI18n } from '../hooks/useI18n'
|
import { useI18n } from '../hooks/useI18n'
|
||||||
import { useRPC } from '../hooks/useRPC'
|
import { useRPC } from '../hooks/useRPC'
|
||||||
|
import { ProcessStatus, RPCResult } from '../types'
|
||||||
import DownloadCard from './DownloadCard'
|
import DownloadCard from './DownloadCard'
|
||||||
|
|
||||||
const DownloadsCardView: React.FC = () => {
|
const DownloadsGridView: React.FC = () => {
|
||||||
const downloads = useRecoilValue(activeDownloadsState)
|
const downloads = useRecoilValue(activeDownloadsState)
|
||||||
|
|
||||||
const { i18n } = useI18n()
|
const { i18n } = useI18n()
|
||||||
const { client } = useRPC()
|
const { client } = useRPC()
|
||||||
const { pushMessage } = useToast()
|
const { pushMessage } = useToast()
|
||||||
|
|
||||||
const abort = (id: string) => client.kill(id)
|
const stop = (r: RPCResult) => r.progress.process_status === ProcessStatus.Completed
|
||||||
|
? client.clear(r.id)
|
||||||
|
: client.kill(r.id)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={{ xs: 2, md: 2 }} columns={{ xs: 4, sm: 8, md: 12, xl: 12 }} pt={2}>
|
<Grid container spacing={{ xs: 2, md: 2 }} columns={{ xs: 4, sm: 8, md: 12, xl: 12 }} pt={2}>
|
||||||
@@ -22,7 +25,7 @@ const DownloadsCardView: React.FC = () => {
|
|||||||
<Grid item xs={4} sm={8} md={6} xl={4} key={download.id}>
|
<Grid item xs={4} sm={8} md={6} xl={4} key={download.id}>
|
||||||
<DownloadCard
|
<DownloadCard
|
||||||
download={download}
|
download={download}
|
||||||
onStop={() => abort(download.id)}
|
onStop={() => stop(download)}
|
||||||
onCopy={() => pushMessage(i18n.t('clipboardAction'), 'info')}
|
onCopy={() => pushMessage(i18n.t('clipboardAction'), 'info')}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -32,4 +35,4 @@ const DownloadsCardView: React.FC = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DownloadsCardView
|
export default DownloadsGridView
|
||||||
@@ -24,7 +24,7 @@ import { useRecoilValue } from 'recoil'
|
|||||||
import { activeDownloadsState } from '../atoms/downloads'
|
import { activeDownloadsState } from '../atoms/downloads'
|
||||||
import { serverURL } from '../atoms/settings'
|
import { serverURL } from '../atoms/settings'
|
||||||
import { useRPC } from '../hooks/useRPC'
|
import { useRPC } from '../hooks/useRPC'
|
||||||
import { RPCResult } from '../types'
|
import { ProcessStatus, RPCResult } from '../types'
|
||||||
import { base64URLEncode, formatSize, formatSpeedMiB } from "../utils"
|
import { base64URLEncode, formatSize, formatSpeedMiB } from "../utils"
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -123,8 +123,6 @@ const DownloadsTableView: React.FC = () => {
|
|||||||
const serverAddr = useRecoilValue(serverURL)
|
const serverAddr = useRecoilValue(serverURL)
|
||||||
const { client } = useRPC()
|
const { client } = useRPC()
|
||||||
|
|
||||||
const abort = (id: string) => client.kill(id)
|
|
||||||
|
|
||||||
const viewFile = (path: string) => {
|
const viewFile = (path: string) => {
|
||||||
const encoded = base64URLEncode(path)
|
const encoded = base64URLEncode(path)
|
||||||
window.open(`${serverAddr}/archive/v/${encoded}?token=${localStorage.getItem('token')}`)
|
window.open(`${serverAddr}/archive/v/${encoded}?token=${localStorage.getItem('token')}`)
|
||||||
@@ -135,6 +133,11 @@ const DownloadsTableView: React.FC = () => {
|
|||||||
window.open(`${serverAddr}/archive/d/${encoded}?token=${localStorage.getItem('token')}`)
|
window.open(`${serverAddr}/archive/d/${encoded}?token=${localStorage.getItem('token')}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stop = (r: RPCResult) => r.progress.process_status === ProcessStatus.Completed
|
||||||
|
? client.clear(r.id)
|
||||||
|
: client.kill(r.id)
|
||||||
|
|
||||||
|
|
||||||
function rowContent(_index: number, download: RPCResult) {
|
function rowContent(_index: number, download: RPCResult) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -170,7 +173,7 @@ const DownloadsTableView: React.FC = () => {
|
|||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => abort(download.id)}
|
onClick={() => stop(download)}
|
||||||
>
|
>
|
||||||
{download.progress.percentage === '-1' ? <DeleteIcon /> : <StopCircleIcon />}
|
{download.progress.percentage === '-1' ? <DeleteIcon /> : <StopCircleIcon />}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const Footer: React.FC = () => {
|
|||||||
display: 'flex', gap: 1, justifyContent: 'space-between'
|
display: 'flex', gap: 1, justifyContent: 'space-between'
|
||||||
}}>
|
}}>
|
||||||
<div style={{ display: 'flex', gap: 4, alignItems: 'center' }}>
|
<div style={{ display: 'flex', gap: 4, alignItems: 'center' }}>
|
||||||
<Chip label="RPC v3.0.9" variant="outlined" size="small" />
|
<Chip label="RPC v3.1.0" variant="outlined" size="small" />
|
||||||
<VersionIndicator />
|
<VersionIndicator />
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: 4, 'alignItems': 'center' }}>
|
<div style={{ display: 'flex', gap: 4, 'alignItems': 'center' }}>
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ const HomeSpeedDial: React.FC<Props> = ({ onDownloadOpen, onEditorOpen }) => {
|
|||||||
const { i18n } = useI18n()
|
const { i18n } = useI18n()
|
||||||
const { client } = useRPC()
|
const { client } = useRPC()
|
||||||
|
|
||||||
const abort = () => client.killAll()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SpeedDial
|
<SpeedDial
|
||||||
ariaLabel="Home speed dial"
|
ariaLabel="Home speed dial"
|
||||||
@@ -47,7 +45,7 @@ const HomeSpeedDial: React.FC<Props> = ({ onDownloadOpen, onEditorOpen }) => {
|
|||||||
<SpeedDialAction
|
<SpeedDialAction
|
||||||
icon={<DeleteForeverIcon />}
|
icon={<DeleteForeverIcon />}
|
||||||
tooltipTitle={i18n.t('abortAllButton')}
|
tooltipTitle={i18n.t('abortAllButton')}
|
||||||
onClick={abort}
|
onClick={() => client.killAll()}
|
||||||
/>
|
/>
|
||||||
<SpeedDialAction
|
<SpeedDialAction
|
||||||
icon={<BuildCircleIcon />}
|
icon={<BuildCircleIcon />}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import AddIcon from '@mui/icons-material/Add'
|
|||||||
import CloseIcon from '@mui/icons-material/Close'
|
import CloseIcon from '@mui/icons-material/Close'
|
||||||
import DeleteIcon from '@mui/icons-material/Delete'
|
import DeleteIcon from '@mui/icons-material/Delete'
|
||||||
import {
|
import {
|
||||||
|
Alert,
|
||||||
AppBar,
|
AppBar,
|
||||||
Backdrop,
|
Backdrop,
|
||||||
Box,
|
Box,
|
||||||
@@ -145,7 +146,12 @@ const TemplatesEditor: React.FC<Props> = ({ open, onClose }) => {
|
|||||||
backgroundColor: (theme) => theme.palette.background.default,
|
backgroundColor: (theme) => theme.palette.background.default,
|
||||||
minHeight: (theme) => `calc(99vh - ${theme.mixins.toolbar.minHeight}px)`
|
minHeight: (theme) => `calc(99vh - ${theme.mixins.toolbar.minHeight}px)`
|
||||||
}}>
|
}}>
|
||||||
<Grid container spacing={2} sx={{ p: 4 }}>
|
<Grid container spacing={2} sx={{ px: 4, pt: 3, pb: 4 }}>
|
||||||
|
<Grid item>
|
||||||
|
<Alert severity="info">
|
||||||
|
{i18n.t('templatesReloadInfo')}
|
||||||
|
</Alert>
|
||||||
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Paper
|
<Paper
|
||||||
elevation={4}
|
elevation={4}
|
||||||
|
|||||||
@@ -132,6 +132,13 @@ export class RPCClient {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clear(id: string) {
|
||||||
|
this.sendHTTP({
|
||||||
|
method: 'Service.Clear',
|
||||||
|
params: [id],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public killAll() {
|
public killAll() {
|
||||||
this.sendHTTP({
|
this.sendHTTP({
|
||||||
method: 'Service.KillAll',
|
method: 'Service.KillAll',
|
||||||
|
|||||||
@@ -34,11 +34,18 @@ type DownloadInfo = {
|
|||||||
created_at: string
|
created_at: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ProcessStatus {
|
||||||
|
Pending = 0,
|
||||||
|
Downloading,
|
||||||
|
Completed,
|
||||||
|
Errored,
|
||||||
|
}
|
||||||
|
|
||||||
type DownloadProgress = {
|
type DownloadProgress = {
|
||||||
speed: number
|
speed: number
|
||||||
eta: number
|
eta: number
|
||||||
percentage: string
|
percentage: string
|
||||||
process_status: number
|
process_status: ProcessStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RPCResult = Readonly<{
|
export type RPCResult = Readonly<{
|
||||||
@@ -76,15 +83,14 @@ export type DirectoryEntry = {
|
|||||||
name: string
|
name: string
|
||||||
path: string
|
path: string
|
||||||
size: number
|
size: number
|
||||||
shaSum: string
|
|
||||||
modTime: string
|
modTime: string
|
||||||
isVideo: boolean
|
isVideo: boolean
|
||||||
isDirectory: boolean
|
isDirectory: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DeleteRequest = Pick<DirectoryEntry, 'path' | 'shaSum'>
|
export type DeleteRequest = Pick<DirectoryEntry, 'path'>
|
||||||
|
|
||||||
export type PlayRequest = Pick<DirectoryEntry, 'path'>
|
export type PlayRequest = DeleteRequest
|
||||||
|
|
||||||
export type CustomTemplate = {
|
export type CustomTemplate = {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { pipe } from 'fp-ts/lib/function'
|
import { pipe } from 'fp-ts/lib/function'
|
||||||
import type { RPCResponse } from "./types"
|
import type { RPCResponse } from "./types"
|
||||||
|
import { ProcessStatus } from './types'
|
||||||
|
|
||||||
export function validateIP(ipAddr: string): boolean {
|
export function validateIP(ipAddr: string): boolean {
|
||||||
let ipRegex = /^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/gm
|
let ipRegex = /^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/gm
|
||||||
@@ -53,15 +54,15 @@ export function isRPCResponse(object: any): object is RPCResponse<any> {
|
|||||||
return 'result' in object && 'id' in object
|
return 'result' in object && 'id' in object
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapProcessStatus(status: number) {
|
export function mapProcessStatus(status: ProcessStatus) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0:
|
case ProcessStatus.Pending:
|
||||||
return 'Pending'
|
return 'Pending'
|
||||||
case 1:
|
case ProcessStatus.Downloading:
|
||||||
return 'Downloading'
|
return 'Downloading'
|
||||||
case 2:
|
case ProcessStatus.Completed:
|
||||||
return 'Completed'
|
return 'Completed'
|
||||||
case 3:
|
case ProcessStatus.Errored:
|
||||||
return 'Error'
|
return 'Error'
|
||||||
default:
|
default:
|
||||||
return 'Pending'
|
return 'Pending'
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ export default function Downloaded() {
|
|||||||
modTime: '',
|
modTime: '',
|
||||||
name: '..',
|
name: '..',
|
||||||
path: upperLevel,
|
path: upperLevel,
|
||||||
shaSum: '',
|
|
||||||
size: 0,
|
size: 0,
|
||||||
}, ...r.filter(f => f.name !== '')]
|
}, ...r.filter(f => f.name !== '')]
|
||||||
: r.filter(f => f.name !== '')
|
: r.filter(f => f.name !== '')
|
||||||
@@ -144,7 +143,6 @@ export default function Downloaded() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
path: entry.path,
|
path: entry.path,
|
||||||
shaSum: entry.shaSum,
|
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
matchW(
|
matchW(
|
||||||
|
|||||||
@@ -6,19 +6,20 @@ import styled from '@emotion/styled'
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Container,
|
Container,
|
||||||
|
Divider,
|
||||||
Paper,
|
Paper,
|
||||||
Stack,
|
Stack,
|
||||||
TextField,
|
TextField,
|
||||||
Typography
|
Typography
|
||||||
} from '@mui/material'
|
} from '@mui/material'
|
||||||
|
import { matchW } from 'fp-ts/lib/TaskEither'
|
||||||
|
import { pipe } from 'fp-ts/lib/function'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { serverURL } from '../atoms/settings'
|
import { serverURL } from '../atoms/settings'
|
||||||
import { useToast } from '../hooks/toast'
|
import { useToast } from '../hooks/toast'
|
||||||
import { ffetch } from '../lib/httpClient'
|
import { ffetch } from '../lib/httpClient'
|
||||||
import { matchW } from 'fp-ts/lib/TaskEither'
|
|
||||||
import { pipe } from 'fp-ts/lib/function'
|
|
||||||
|
|
||||||
const LoginContainer = styled(Container)({
|
const LoginContainer = styled(Container)({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -81,6 +82,8 @@ export default function Login() {
|
|||||||
)()
|
)()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loginWithOpenId = () => window.open(`${url}/auth/openid/login`)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoginContainer>
|
<LoginContainer>
|
||||||
<Paper sx={{ padding: '1.5rem', minWidth: '25%' }}>
|
<Paper sx={{ padding: '1.5rem', minWidth: '25%' }}>
|
||||||
@@ -89,12 +92,8 @@ export default function Login() {
|
|||||||
yt-dlp WebUI
|
yt-dlp WebUI
|
||||||
</Title>
|
</Title>
|
||||||
<Title fontWeight={'500'} fontSize={16} color={'gray'}>
|
<Title fontWeight={'500'} fontSize={16} color={'gray'}>
|
||||||
Authentication token will expire after 30 days.
|
To configure authentication check the
|
||||||
</Title>
|
<a href='https://github.com/marcopeocchi/yt-dlp-web-ui/wiki/Authentication-methods'>wiki</a>.
|
||||||
<Title fontWeight={'500'} fontSize={16} color={'gray'}>
|
|
||||||
In order to enable RPC authentication append the --auth,
|
|
||||||
<br />
|
|
||||||
--user [username] and --pass [password] flags.
|
|
||||||
</Title>
|
</Title>
|
||||||
<TextField
|
<TextField
|
||||||
label="Username"
|
label="Username"
|
||||||
@@ -113,6 +112,16 @@ export default function Login() {
|
|||||||
<Button variant="contained" size="large" onClick={() => login()}>
|
<Button variant="contained" size="large" onClick={() => login()}>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Divider>
|
||||||
|
<Typography color={'gray'}>
|
||||||
|
or use your authentication provider
|
||||||
|
</Typography>
|
||||||
|
</Divider>
|
||||||
|
|
||||||
|
<Button variant="contained" size="large" onClick={loginWithOpenId}>
|
||||||
|
Login with OpenID
|
||||||
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
</LoginContainer>
|
</LoginContainer>
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ export default function Settings() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Typography variant="h6" color="primary" sx={{ mt: 0.5, mb: 2 }}>
|
<Typography variant="h6" color="primary" sx={{ mt: 0.5, mb: 2 }}>
|
||||||
Appaerance
|
Appearance
|
||||||
</Typography>
|
</Typography>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
|
|||||||
23
go.mod
23
go.mod
@@ -4,23 +4,26 @@ go 1.22
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
|
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
|
||||||
github.com/go-chi/chi/v5 v5.0.12
|
github.com/coreos/go-oidc/v3 v3.11.0
|
||||||
|
github.com/go-chi/chi/v5 v5.1.0
|
||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/cors v1.2.1
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/gorilla/websocket v1.5.1
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/reactivex/rxgo/v2 v2.5.0
|
github.com/reactivex/rxgo/v2 v2.5.0
|
||||||
golang.org/x/sync v0.6.0
|
golang.org/x/oauth2 v0.21.0
|
||||||
golang.org/x/sys v0.18.0
|
golang.org/x/sync v0.7.0
|
||||||
|
golang.org/x/sys v0.22.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
modernc.org/sqlite v1.29.5
|
modernc.org/sqlite v1.31.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
github.com/emirpasic/gods v1.18.1 // indirect
|
github.com/emirpasic/gods v1.18.1 // indirect
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||||
@@ -29,11 +32,11 @@ require (
|
|||||||
github.com/stretchr/objx v0.5.2 // indirect
|
github.com/stretchr/objx v0.5.2 // indirect
|
||||||
github.com/stretchr/testify v1.9.0 // indirect
|
github.com/stretchr/testify v1.9.0 // indirect
|
||||||
github.com/teivah/onecontext v1.3.0 // indirect
|
github.com/teivah/onecontext v1.3.0 // indirect
|
||||||
golang.org/x/net v0.22.0 // indirect
|
golang.org/x/crypto v0.25.0 // indirect
|
||||||
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
|
modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e // indirect
|
||||||
modernc.org/libc v1.47.0 // indirect
|
modernc.org/libc v1.55.7 // indirect
|
||||||
modernc.org/mathutil v1.6.0 // indirect
|
modernc.org/mathutil v1.6.0 // indirect
|
||||||
modernc.org/memory v1.7.2 // indirect
|
modernc.org/memory v1.8.0 // indirect
|
||||||
modernc.org/strutil v1.2.0 // indirect
|
modernc.org/strutil v1.2.0 // indirect
|
||||||
modernc.org/token v1.1.0 // indirect
|
modernc.org/token v1.1.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
70
go.sum
70
go.sum
@@ -1,8 +1,10 @@
|
|||||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM=
|
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM=
|
||||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
|
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
|
||||||
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
||||||
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
|
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||||
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
|
github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI=
|
||||||
|
github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -11,18 +13,24 @@ github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+m
|
|||||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||||
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
|
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
|
||||||
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
||||||
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.3 h1:o8aphO8Hv6RPmH+GfzVuyf7YXSBibp+8YyHdOoDESGo=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.3/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
|
||||||
|
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
@@ -32,8 +40,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
|
||||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
|
||||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
@@ -55,27 +61,31 @@ github.com/teivah/onecontext v1.3.0/go.mod h1:hoW1nmdPVK/0jrvGtcx8sCKYs2PiS4z0zz
|
|||||||
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
|
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
|
||||||
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
|
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||||
|
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
|
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
|
||||||
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
|
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
|
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
|
||||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
|
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
|
||||||
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
|
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
|
||||||
|
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
@@ -83,28 +93,32 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
|
|||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
modernc.org/cc/v4 v4.19.5 h1:QlsZyQ1zf78DGeqnQ9ILi9hXyMdoC5e1qoGNUyBjHQw=
|
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
|
||||||
modernc.org/cc/v4 v4.19.5/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
|
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
|
||||||
modernc.org/ccgo/v4 v4.13.0 h1:99E8QHRoPrXN8VpS0zgAgJ5nSjpXrPKpsJIMvGL/2Oc=
|
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
|
||||||
modernc.org/ccgo/v4 v4.13.0/go.mod h1:Td6RI9W9G2ZpKHaJ7UeGEiB2aIpoDqLBnm4wtkbJTbQ=
|
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
|
||||||
|
modernc.org/ccgo/v4 v4.20.5 h1:s04akhT2dysD0DFOlv9fkQ6oUTLPYgMnnDk9oaqjszM=
|
||||||
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
|
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
|
||||||
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
|
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
|
||||||
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
|
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
|
||||||
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
|
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
|
||||||
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8=
|
modernc.org/gc/v2 v2.4.3 h1:Ik4ZcMbC7aY4ZDPUhzXVXi7GMub9QcXLTfXn3mWpNw8=
|
||||||
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
|
modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e h1:WPC4v0rNIFb2PY+nBBEEKyugPPRHPzUgyN3xZPpGK58=
|
||||||
modernc.org/libc v1.47.0 h1:BXrzId9fOOkBtS+uFQ5aZyVGmt7WcSEPrXF5Kwsho90=
|
modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
|
||||||
modernc.org/libc v1.47.0/go.mod h1:gzCncw0a74aCiVqHeWAYHHaW//fkSHHS/3S/gfhLlCI=
|
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
|
||||||
|
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
|
||||||
|
modernc.org/libc v1.55.7 h1:/5PMGAF3tyZhK72WpoqeLNtgUUpYMrnhT+Gm/5tVDgs=
|
||||||
|
modernc.org/libc v1.55.7/go.mod h1:JXguUpMkbw1gknxspNE9XaG+kk9hDAAnBxpA6KGLiyA=
|
||||||
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
||||||
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
||||||
modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
|
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
|
||||||
modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
|
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
|
||||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||||
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
|
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
|
||||||
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
|
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
|
||||||
modernc.org/sqlite v1.29.5 h1:8l/SQKAjDtZFo9lkJLdk8g9JEOeYRG4/ghStDCCTiTE=
|
modernc.org/sqlite v1.31.1 h1:XVU0VyzxrYHlBhIs1DiEgSl0ZtdnPtbLVy8hSkzxGrs=
|
||||||
modernc.org/sqlite v1.29.5/go.mod h1:S02dvcmm7TnTRvGhv8IGYyLnIt7AS2KPaB1F/71p75U=
|
modernc.org/sqlite v1.31.1/go.mod h1:UqoylwmTb9F+IqXERT8bW9zzOWN8qwAIcLdzeBZs4hA=
|
||||||
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
|
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
|
||||||
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
|
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
|
||||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/cli"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/cli"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/openid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -91,6 +92,8 @@ func main() {
|
|||||||
log.Println(cli.BgRed, "config", cli.Reset, err)
|
log.Println(cli.BgRed, "config", cli.Reset, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openid.Configure()
|
||||||
|
|
||||||
server.RunBlocking(&server.RunConfig{
|
server.RunBlocking(&server.RunConfig{
|
||||||
Host: c.Host,
|
Host: c.Host,
|
||||||
Port: c.Port,
|
Port: c.Port,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -20,6 +21,13 @@ type Config struct {
|
|||||||
Password string `yaml:"password"`
|
Password string `yaml:"password"`
|
||||||
QueueSize int `yaml:"queue_size"`
|
QueueSize int `yaml:"queue_size"`
|
||||||
SessionFilePath string `yaml:"session_file_path"`
|
SessionFilePath string `yaml:"session_file_path"`
|
||||||
|
path string
|
||||||
|
|
||||||
|
UseOpenId bool `yaml:"use_openid"`
|
||||||
|
OpenIdProviderURL string `yaml:"openid_provider_url"`
|
||||||
|
OpenIdClientId string `yaml:"openid_client_id"`
|
||||||
|
OpenIdClientSecret string `yaml:"openid_client_secret"`
|
||||||
|
OpenIdRedirectURL string `yaml:"openid_redirect_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -43,9 +51,17 @@ func (c *Config) LoadFile(filename string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.path = filename
|
||||||
|
|
||||||
if err := yaml.NewDecoder(fd).Decode(c); err != nil {
|
if err := yaml.NewDecoder(fd).Decode(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Path of the directory containing the config file
|
||||||
|
func (c *Config) Dir() string { return filepath.Dir(c.path) }
|
||||||
|
|
||||||
|
// Absolute path of the config file
|
||||||
|
func (c *Config) Path() string { return c.path }
|
||||||
|
|||||||
@@ -3,29 +3,41 @@ package dbutil
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var lockFilePath = filepath.Join(config.Instance().Dir(), ".db.lock")
|
||||||
|
|
||||||
// Run the table migration
|
// Run the table migration
|
||||||
func AutoMigrate(ctx context.Context, db *sql.DB) error {
|
func Migrate(ctx context.Context, db *sql.DB) error {
|
||||||
conn, err := db.Conn(ctx)
|
conn, err := db.Conn(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer conn.Close()
|
defer func() {
|
||||||
|
conn.Close()
|
||||||
|
createLockFile()
|
||||||
|
}()
|
||||||
|
|
||||||
_, err = db.ExecContext(
|
if _, err := db.ExecContext(
|
||||||
ctx,
|
ctx,
|
||||||
`CREATE TABLE IF NOT EXISTS templates (
|
`CREATE TABLE IF NOT EXISTS templates (
|
||||||
id CHAR(36) PRIMARY KEY,
|
id CHAR(36) PRIMARY KEY,
|
||||||
name VARCHAR(255) NOT NULL,
|
name VARCHAR(255) NOT NULL,
|
||||||
content TEXT NOT NULL
|
content TEXT NOT NULL
|
||||||
)`,
|
)`,
|
||||||
)
|
); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if lockFileExists() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
db.ExecContext(
|
db.ExecContext(
|
||||||
ctx,
|
ctx,
|
||||||
`INSERT INTO templates (id, name, content) VALUES
|
`INSERT INTO templates (id, name, content) VALUES
|
||||||
@@ -35,5 +47,12 @@ func AutoMigrate(ctx context.Context, db *sql.DB) error {
|
|||||||
"1", "audio only", "-x",
|
"1", "audio only", "-x",
|
||||||
)
|
)
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func createLockFile() { os.Create(lockFilePath) }
|
||||||
|
|
||||||
|
func lockFileExists() bool {
|
||||||
|
_, err := os.Stat(lockFilePath)
|
||||||
|
return os.IsExist(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ func (m *MessageQueue) downloadConsumer() {
|
|||||||
slog.String("id", p.getShortId()),
|
slog.String("id", p.getShortId()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if p.Progress.Status != StatusCompleted {
|
||||||
p.Start()
|
p.Start()
|
||||||
|
}
|
||||||
|
|
||||||
m.logger.Info("started process",
|
m.logger.Info("started process",
|
||||||
slog.String("bus", queueName),
|
slog.String("bus", queueName),
|
||||||
@@ -92,6 +94,14 @@ func (m *MessageQueue) metadataSubscriber() {
|
|||||||
slog.String("id", p.getShortId()),
|
slog.String("id", p.getShortId()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if p.Progress.Status == StatusCompleted {
|
||||||
|
m.logger.Warn("proccess has an illegal state",
|
||||||
|
slog.String("id", p.getShortId()),
|
||||||
|
slog.Int("status", p.Progress.Status),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := p.SetMetadata(); err != nil {
|
if err := p.SetMetadata(); err != nil {
|
||||||
m.logger.Error("failed to retrieve metadata",
|
m.logger.Error("failed to retrieve metadata",
|
||||||
slog.String("id", p.getShortId()),
|
slog.String("id", p.getShortId()),
|
||||||
|
|||||||
@@ -198,18 +198,22 @@ func (p *Process) Complete() {
|
|||||||
|
|
||||||
// Kill a process and remove it from the memory
|
// Kill a process and remove it from the memory
|
||||||
func (p *Process) Kill() error {
|
func (p *Process) Kill() error {
|
||||||
|
defer func() {
|
||||||
|
p.Progress.Status = StatusCompleted
|
||||||
|
}()
|
||||||
// yt-dlp uses multiple child process the parent process
|
// yt-dlp uses multiple child process the parent process
|
||||||
// has been spawned with setPgid = true. To properly kill
|
// has been spawned with setPgid = true. To properly kill
|
||||||
// all subprocesses a SIGTERM need to be sent to the correct
|
// all subprocesses a SIGTERM need to be sent to the correct
|
||||||
// process group
|
// process group
|
||||||
if p.proc != nil {
|
if p.proc == nil {
|
||||||
|
return errors.New("*os.Process not set")
|
||||||
|
}
|
||||||
|
|
||||||
pgid, err := syscall.Getpgid(p.proc.Pid)
|
pgid, err := syscall.Getpgid(p.proc.Pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = syscall.Kill(-pgid, syscall.SIGTERM)
|
if err := syscall.Kill(-pgid, syscall.SIGTERM); err != nil {
|
||||||
|
|
||||||
p.Logger.Info("killed process", slog.String("id", p.Id))
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,15 +222,12 @@ func (p *Process) Kill() error {
|
|||||||
|
|
||||||
// Returns the available format for this URL
|
// Returns the available format for this URL
|
||||||
// TODO: Move out from process.go
|
// TODO: Move out from process.go
|
||||||
func (p *Process) GetFormatsSync() (DownloadFormats, error) {
|
func (p *Process) GetFormats() (DownloadFormats, error) {
|
||||||
cmd := exec.Command(config.Instance().DownloaderPath, p.Url, "-J")
|
cmd := exec.Command(config.Instance().DownloaderPath, p.Url, "-J")
|
||||||
|
|
||||||
stdout, err := cmd.Output()
|
stdout, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.Logger.Error(
|
p.Logger.Error("failed to retrieve metadata", slog.String("err", err.Error()))
|
||||||
"failed to retrieve metadata",
|
|
||||||
slog.String("err", err.Error()),
|
|
||||||
)
|
|
||||||
return DownloadFormats{}, err
|
return DownloadFormats{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +257,6 @@ func (p *Process) GetFormatsSync() (DownloadFormats, error) {
|
|||||||
decodingError = json.Unmarshal(stdout, &info)
|
decodingError = json.Unmarshal(stdout, &info)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
decodingError = json.Unmarshal(stdout, &best)
|
decodingError = json.Unmarshal(stdout, &best)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/openid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var upgrader = websocket.Upgrader{
|
var upgrader = websocket.Upgrader{
|
||||||
@@ -77,6 +78,9 @@ func ApplyRouter() func(chi.Router) {
|
|||||||
if config.Instance().RequireAuth {
|
if config.Instance().RequireAuth {
|
||||||
r.Use(middlewares.Authenticated)
|
r.Use(middlewares.Authenticated)
|
||||||
}
|
}
|
||||||
|
if config.Instance().UseOpenId {
|
||||||
|
r.Use(openid.Middleware)
|
||||||
|
}
|
||||||
r.Get("/ws", webSocket)
|
r.Get("/ws", webSocket)
|
||||||
r.Get("/sse", sse)
|
r.Get("/sse", sse)
|
||||||
}
|
}
|
||||||
|
|||||||
37
server/openid/config.go
Normal file
37
server/openid/config.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package openid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
oauth2Config oauth2.Config
|
||||||
|
verifier *oidc.IDTokenVerifier
|
||||||
|
)
|
||||||
|
|
||||||
|
func Configure() {
|
||||||
|
if !config.Instance().UseOpenId {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
provider, err := oidc.NewProvider(context.Background(), config.Instance().OpenIdProviderURL)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2Config = oauth2.Config{
|
||||||
|
ClientID: config.Instance().OpenIdClientId,
|
||||||
|
ClientSecret: config.Instance().OpenIdClientSecret,
|
||||||
|
RedirectURL: config.Instance().OpenIdRedirectURL,
|
||||||
|
Endpoint: provider.Endpoint(),
|
||||||
|
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
|
||||||
|
}
|
||||||
|
|
||||||
|
verifier = provider.Verifier(&oidc.Config{
|
||||||
|
ClientID: config.Instance().OpenIdClientId,
|
||||||
|
})
|
||||||
|
}
|
||||||
179
server/openid/handler.go
Normal file
179
server/openid/handler.go
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
package openid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OAuth2SuccessResponse struct {
|
||||||
|
OAuth2Token *oauth2.Token
|
||||||
|
IDTokenClaims *json.RawMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
func Login(w http.ResponseWriter, r *http.Request) {
|
||||||
|
state := uuid.NewString()
|
||||||
|
|
||||||
|
nonceBytes := make([]byte, 16)
|
||||||
|
rand.Read(nonceBytes)
|
||||||
|
|
||||||
|
nonce := hex.EncodeToString(nonceBytes)
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "state",
|
||||||
|
Value: state,
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: int(time.Hour * 24 * 30),
|
||||||
|
})
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "nonce",
|
||||||
|
Value: nonce,
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: int(time.Hour * 24 * 30),
|
||||||
|
})
|
||||||
|
|
||||||
|
http.Redirect(w, r, oauth2Config.AuthCodeURL(state, oidc.Nonce(nonce)), http.StatusFound)
|
||||||
|
}
|
||||||
|
|
||||||
|
func doAuthentification(r *http.Request, setCookieCallback func(t *oauth2.Token)) (*OAuth2SuccessResponse, error) {
|
||||||
|
state, err := r.Cookie("state")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.URL.Query().Get("state") != state.Value {
|
||||||
|
return nil, errors.New("auth state does not match")
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2Token, err := oauth2Config.Exchange(r.Context(), r.URL.Query().Get("code"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rawToken, ok := oauth2Token.Extra("id_token").(string)
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("openid field \"id_token\" not found in oauth2 token")
|
||||||
|
}
|
||||||
|
|
||||||
|
idToken, err := verifier.Verify(r.Context(), rawToken)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
nonce, err := r.Cookie("nonce")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if idToken.Nonce != nonce.Value {
|
||||||
|
return nil, errors.New("auth nonce does not match")
|
||||||
|
}
|
||||||
|
|
||||||
|
setCookieCallback(oauth2Token)
|
||||||
|
|
||||||
|
// redact
|
||||||
|
oauth2Token.AccessToken = "*REDACTED*"
|
||||||
|
|
||||||
|
res := OAuth2SuccessResponse{
|
||||||
|
oauth2Token,
|
||||||
|
&json.RawMessage{},
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := idToken.Claims(&res.IDTokenClaims); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func SingIn(w http.ResponseWriter, r *http.Request) {
|
||||||
|
_, err := doAuthentification(r, func(t *oauth2.Token) {
|
||||||
|
idToken, _ := t.Extra("id_token").(string)
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "oid-token",
|
||||||
|
Value: idToken,
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: int(time.Hour * 24 * 30),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// if err := json.NewEncoder(w).Encode(res); err != nil {
|
||||||
|
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
w.Write([]byte("Login succesfully, you may now close this window and refresh yt-dlp-webui."))
|
||||||
|
}
|
||||||
|
|
||||||
|
func Refresh(w http.ResponseWriter, r *http.Request) {
|
||||||
|
refreshToken := r.URL.Query().Get("refresh-token")
|
||||||
|
|
||||||
|
ts := oauth2Config.TokenSource(r.Context(), &oauth2.Token{RefreshToken: refreshToken})
|
||||||
|
|
||||||
|
token, err := ts.Token()
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "oid-token",
|
||||||
|
Value: token.AccessToken,
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: int(time.Hour * 24 * 30),
|
||||||
|
})
|
||||||
|
|
||||||
|
token.AccessToken = "*redacted*"
|
||||||
|
|
||||||
|
if err := json.NewEncoder(w).Encode(token); err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Logout(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "oid-token",
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: -1,
|
||||||
|
})
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "state",
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: -1,
|
||||||
|
})
|
||||||
|
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "nonce",
|
||||||
|
HttpOnly: true,
|
||||||
|
Path: "/",
|
||||||
|
Secure: r.TLS != nil,
|
||||||
|
MaxAge: -1,
|
||||||
|
})
|
||||||
|
}
|
||||||
20
server/openid/middleware.go
Normal file
20
server/openid/middleware.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package openid
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
func Middleware(next http.Handler) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
token, err := r.Cookie("oid-token")
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := verifier.Verify(r.Context(), token.Value); err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/openid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Container(args *ContainerArgs) *Handler {
|
func Container(args *ContainerArgs) *Handler {
|
||||||
@@ -21,6 +22,9 @@ func ApplyRouter(args *ContainerArgs) func(chi.Router) {
|
|||||||
if config.Instance().RequireAuth {
|
if config.Instance().RequireAuth {
|
||||||
r.Use(middlewares.Authenticated)
|
r.Use(middlewares.Authenticated)
|
||||||
}
|
}
|
||||||
|
if config.Instance().UseOpenId {
|
||||||
|
r.Use(openid.Middleware)
|
||||||
|
}
|
||||||
r.Post("/exec", h.Exec())
|
r.Post("/exec", h.Exec())
|
||||||
r.Get("/running", h.Running())
|
r.Get("/running", h.Running())
|
||||||
r.Get("/version", h.GetVersion())
|
r.Get("/version", h.GetVersion())
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/openid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dependency injection container.
|
// Dependency injection container.
|
||||||
@@ -28,6 +29,9 @@ func ApplyRouter() func(chi.Router) {
|
|||||||
if config.Instance().RequireAuth {
|
if config.Instance().RequireAuth {
|
||||||
r.Use(middlewares.Authenticated)
|
r.Use(middlewares.Authenticated)
|
||||||
}
|
}
|
||||||
|
if config.Instance().UseOpenId {
|
||||||
|
r.Use(openid.Middleware)
|
||||||
|
}
|
||||||
r.Get("/ws", WebSocket)
|
r.Get("/ws", WebSocket)
|
||||||
r.Post("/http", Post)
|
r.Post("/http", Post)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package rpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
@@ -30,8 +29,6 @@ func WebSocket(w http.ResponseWriter, r *http.Request) {
|
|||||||
for {
|
for {
|
||||||
mtype, reader, err := c.NextReader()
|
mtype, reader, err := c.NextReader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
log.Println(err)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +37,6 @@ func WebSocket(w http.ResponseWriter, r *http.Request) {
|
|||||||
writer, err := c.NextWriter(mtype)
|
writer, err := c.NextWriter(mtype)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
log.Println(err)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package rpc
|
package rpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||||
@@ -74,7 +75,7 @@ func (s *Service) Formats(args Args, meta *internal.DownloadFormats) error {
|
|||||||
err error
|
err error
|
||||||
p = internal.Process{Url: args.URL, Logger: s.logger}
|
p = internal.Process{Url: args.URL, Logger: s.logger}
|
||||||
)
|
)
|
||||||
*meta, err = p.GetFormatsSync()
|
*meta, err = p.GetFormats()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,13 +100,19 @@ func (s *Service) Kill(args string, killed *string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc != nil {
|
if proc == nil {
|
||||||
err = proc.Kill()
|
return errors.New("nil process")
|
||||||
s.db.Delete(proc.Id)
|
}
|
||||||
|
|
||||||
|
if err := proc.Kill(); err != nil {
|
||||||
|
s.logger.Info("failed killing process", slog.String("id", proc.Id), slog.Any("err", err))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.db.Delete(proc.Id)
|
s.db.Delete(proc.Id)
|
||||||
return err
|
s.logger.Info("succesfully killed process", slog.String("id", proc.Id))
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// KillAll kills all process unconditionally and removes them from
|
// KillAll kills all process unconditionally and removes them from
|
||||||
@@ -115,7 +122,10 @@ func (s *Service) KillAll(args NoArgs, killed *string) error {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
keys = s.db.Keys()
|
keys = s.db.Keys()
|
||||||
err error
|
removeFunc = func(p *internal.Process) error {
|
||||||
|
defer s.db.Delete(p.Id)
|
||||||
|
return p.Kill()
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, key := range *keys {
|
for _, key := range *keys {
|
||||||
@@ -124,13 +134,24 @@ func (s *Service) KillAll(args NoArgs, killed *string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc != nil {
|
if proc == nil {
|
||||||
proc.Kill()
|
s.db.Delete(key)
|
||||||
s.db.Delete(proc.Id)
|
continue
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
if err := removeFunc(proc); err != nil {
|
||||||
|
s.logger.Info(
|
||||||
|
"failed killing process",
|
||||||
|
slog.String("id", proc.Id),
|
||||||
|
slog.Any("err", err),
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
s.logger.Info("succesfully killed process", slog.String("id", proc.Id))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a process from the db rendering it unusable if active
|
// Remove a process from the db rendering it unusable if active
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/logging"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/logging"
|
||||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||||
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/openid"
|
||||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/rest"
|
"github.com/marcopeocchi/yt-dlp-web-ui/server/rest"
|
||||||
ytdlpRPC "github.com/marcopeocchi/yt-dlp-web-ui/server/rpc"
|
ytdlpRPC "github.com/marcopeocchi/yt-dlp-web-ui/server/rpc"
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ func RunBlocking(cfg *RunConfig) {
|
|||||||
logger.Error("failed to open database", slog.String("err", err.Error()))
|
logger.Error("failed to open database", slog.String("err", err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := dbutil.AutoMigrate(context.Background(), db); err != nil {
|
if err := dbutil.Migrate(context.Background(), db); err != nil {
|
||||||
logger.Error("failed to init database", slog.String("err", err.Error()))
|
logger.Error("failed to init database", slog.String("err", err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +169,9 @@ func newServer(c serverConfig) *http.Server {
|
|||||||
if config.Instance().RequireAuth {
|
if config.Instance().RequireAuth {
|
||||||
r.Use(middlewares.Authenticated)
|
r.Use(middlewares.Authenticated)
|
||||||
}
|
}
|
||||||
|
if config.Instance().UseOpenId {
|
||||||
|
r.Use(openid.Middleware)
|
||||||
|
}
|
||||||
r.Post("/downloaded", handlers.ListDownloaded)
|
r.Post("/downloaded", handlers.ListDownloaded)
|
||||||
r.Post("/delete", handlers.DeleteFile)
|
r.Post("/delete", handlers.DeleteFile)
|
||||||
r.Get("/d/{id}", handlers.DownloadFile)
|
r.Get("/d/{id}", handlers.DownloadFile)
|
||||||
@@ -179,6 +183,12 @@ func newServer(c serverConfig) *http.Server {
|
|||||||
r.Route("/auth", func(r chi.Router) {
|
r.Route("/auth", func(r chi.Router) {
|
||||||
r.Post("/login", handlers.Login)
|
r.Post("/login", handlers.Login)
|
||||||
r.Get("/logout", handlers.Logout)
|
r.Get("/logout", handlers.Logout)
|
||||||
|
|
||||||
|
r.Route("/openid", func(r chi.Router) {
|
||||||
|
r.Get("/login", openid.Login)
|
||||||
|
r.Get("/signin", openid.SingIn)
|
||||||
|
r.Get("/logout", openid.Logout)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// RPC handlers
|
// RPC handlers
|
||||||
|
|||||||
Reference in New Issue
Block a user