Browse Source
* Replace pkger with go:embed for bundling the admin. Closes #844 * Remove references to pkged.go * Point tests to use an updated version of Go * Add comment to new exported function * Cleanup * Add a dummy pkged.go to alert people to stop using it. * Add simple browser test to make sure the admin is available and renders * Don't panicpull/1469/head
81 changed files with 203 additions and 75 deletions
@ -1,49 +1,50 @@
@@ -1,49 +1,50 @@
|
||||
package admin |
||||
|
||||
import ( |
||||
"io/ioutil" |
||||
"mime" |
||||
"bytes" |
||||
"net/http" |
||||
"os" |
||||
"path/filepath" |
||||
"strings" |
||||
|
||||
"github.com/markbates/pkger" |
||||
"github.com/owncast/owncast/router/middleware" |
||||
"github.com/owncast/owncast/static" |
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// ServeAdmin will return admin web assets.
|
||||
func ServeAdmin(w http.ResponseWriter, r *http.Request) { |
||||
// Set a cache control max-age header
|
||||
middleware.SetCachingHeaders(w, r) |
||||
adminFiles := static.GetAdmin() |
||||
|
||||
// Determine if the requested path is a directory.
|
||||
// If so, append index.html to the request.
|
||||
path := r.URL.Path |
||||
dirCheck, err := pkger.Stat(path) |
||||
if dirCheck != nil && err == nil && dirCheck.IsDir() { |
||||
path := strings.TrimPrefix(r.URL.Path, "/") |
||||
if strings.HasSuffix(path, "/") { |
||||
path = filepath.Join(path, "index.html") |
||||
} |
||||
|
||||
f, err := pkger.Open(path) |
||||
if err != nil { |
||||
log.Debugln(err, path) |
||||
errorHandler(w, http.StatusNotFound) |
||||
f, err := adminFiles.Open(path) |
||||
if os.IsNotExist(err) { |
||||
w.WriteHeader(http.StatusNotFound) |
||||
return |
||||
} |
||||
|
||||
b, err := ioutil.ReadAll(f) |
||||
if err != nil { |
||||
log.Warnln(err) |
||||
info, err := f.Stat() |
||||
|
||||
if os.IsNotExist(err) { |
||||
w.WriteHeader(http.StatusNotFound) |
||||
return |
||||
} |
||||
|
||||
mimeType := mime.TypeByExtension(filepath.Ext(path)) |
||||
w.Header().Set("Content-Type", mimeType) |
||||
if _, err = w.Write(b); err != nil { |
||||
// Set a cache control max-age header
|
||||
middleware.SetCachingHeaders(w, r) |
||||
|
||||
d, err := adminFiles.ReadFile(path) |
||||
if err != nil { |
||||
log.Errorln(err) |
||||
w.WriteHeader(http.StatusInternalServerError) |
||||
return |
||||
} |
||||
} |
||||
|
||||
func errorHandler(w http.ResponseWriter, status int) { |
||||
w.WriteHeader(status) |
||||
http.ServeContent(w, r, info.Name(), info.ModTime(), bytes.NewReader(d)) |
||||
} |
||||
|
@ -1,36 +1,43 @@
@@ -1,36 +1,43 @@
|
||||
module github.com/owncast/owncast |
||||
|
||||
go 1.14 |
||||
go 1.17 |
||||
|
||||
require ( |
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect |
||||
github.com/amalfra/etag v0.0.0-20190921100247-cafc8de96bc5 |
||||
github.com/aws/aws-sdk-go v1.40.0 |
||||
github.com/go-ole/go-ole v1.2.4 // indirect |
||||
github.com/gorilla/websocket v1.4.2 |
||||
github.com/grafov/m3u8 v0.11.1 |
||||
github.com/jonboulle/clockwork v0.2.2 // indirect |
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible |
||||
github.com/lestrrat-go/strftime v1.0.4 // indirect |
||||
github.com/markbates/pkger v0.17.1 |
||||
github.com/mattn/go-sqlite3 v1.14.8 |
||||
github.com/microcosm-cc/bluemonday v1.0.15 |
||||
github.com/mssola/user_agent v0.5.3 |
||||
github.com/mvdan/xurls v1.1.0 // indirect |
||||
github.com/nareix/joy5 v0.0.0-20200712071056-a55089207c88 |
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect |
||||
github.com/oschwald/geoip2-golang v1.5.0 |
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 |
||||
github.com/schollz/sqlite3dump v1.3.0 |
||||
github.com/shirou/gopsutil v3.21.9+incompatible |
||||
github.com/sirupsen/logrus v1.8.1 |
||||
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf |
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect |
||||
github.com/yuin/goldmark v1.4.1 |
||||
golang.org/x/mod v0.5.1 |
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect |
||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 |
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect |
||||
gopkg.in/yaml.v2 v2.4.0 // indirect |
||||
mvdan.cc/xurls v1.1.0 |
||||
) |
||||
|
||||
require ( |
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect |
||||
github.com/aymerick/douceur v0.2.0 // indirect |
||||
github.com/go-ole/go-ole v1.2.4 // indirect |
||||
github.com/gorilla/css v1.0.0 // indirect |
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect |
||||
github.com/jonboulle/clockwork v0.2.2 // indirect |
||||
github.com/lestrrat-go/strftime v1.0.4 // indirect |
||||
github.com/mvdan/xurls v1.1.0 // indirect |
||||
github.com/oschwald/maxminddb-golang v1.8.0 // indirect |
||||
github.com/pkg/errors v0.9.1 // indirect |
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect |
||||
github.com/tklauser/numcpus v0.2.2 // indirect |
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect |
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect |
||||
gopkg.in/yaml.v2 v2.4.0 // indirect |
||||
) |
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,f,n,b,d,o,h,g,u){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,c,e,t,i,f,b,"static/chunks/pages/index-3ba269b54a8f308320fd.js"],"/_error":["static/chunks/pages/_error-ea939aab753d9e9db3bd.js"],"/access-tokens":[s,c,a,"static/chunks/pages/access-tokens-9bc1c9dd3309a3ec4f21.js"],"/actions":[s,a,"static/chunks/pages/actions-877d508e9ce23f852ac6.js"],"/chat/messages":[d,s,c,a,f,o,"static/chunks/pages/chat/messages-7ee04cd432c0e9a41c62.js"],"/chat/users":[d,s,c,a,f,o,"static/chunks/pages/chat/users-3e30c33f945e12103605.js"],"/config-chat":["static/chunks/pages/config-chat-9e64011c5142bb4cde30.js"],"/config-public-details":[s,a,n,"static/css/daab8d18100466477c6d.css","static/chunks/361-11c54fbc23b235ad7af7.js","static/chunks/pages/config-public-details-3c26a3ed0000b5440538.js"],"/config-server-details":[h,"static/chunks/pages/config-server-details-d708db0714de42812fbd.js"],"/config-social-items":[s,a,"static/chunks/pages/config-social-items-a7f65f614734b1284dc5.js"],"/config-storage":["static/chunks/pages/config-storage-376cc500207ec51ed7bd.js"],"/config-video":[s,a,h,"static/chunks/364-d398b818a027a7a7eb4e.js","static/chunks/pages/config-video-d4c8ac1f1f5e2b10a1b2.js"],"/hardware-info":[g,c,e,i,n,u,"static/chunks/pages/hardware-info-f9651667f386dc8adc51.js"],"/help":[e,"static/chunks/334-7b22cd3bdbdd9b073ddd.js","static/chunks/pages/help-addeb25f330508a229ad.js"],"/logs":[s,c,t,"static/chunks/pages/logs-80d875f16adc4edd0cec.js"],"/offline-notice":[s,c,e,t,b,"static/chunks/pages/offline-notice-220dfaa8eb4b5d8a1ef0.js"],"/upgrade":[s,"static/chunks/840-e2546e86a9f097d6f20f.js","static/chunks/pages/upgrade-c5fdf5dc1f90cc34e241.js"],"/viewer-info":[g,c,e,i,n,u,"static/chunks/pages/viewer-info-99bf5368ac1c24732e47.js"],"/webhooks":[s,a,"static/chunks/pages/webhooks-927f6b527b4234d4fa06.js"],sortedPages:["/","/_app","/_error","/access-tokens","/actions","/chat/messages","/chat/users","/config-chat","/config-public-details","/config-server-details","/config-social-items","/config-storage","/config-video","/hardware-info","/help","/logs","/offline-notice","/upgrade","/viewer-info","/webhooks"]}}("static/chunks/23-f55205d707e591f0168c.js","static/chunks/924-f83c6a5efb63742cec73.js","static/chunks/614-1e74c3ac41cdd8da7cad.js","static/chunks/689-35f2a306e6434b0319fd.js","static/chunks/835-4646cc28de3139d4e0d8.js","static/chunks/277-523d880908ae13758a1f.js","static/chunks/354-90541e85108fb0b393fd.js","static/chunks/74-ef23b34310205aa6b8db.js","static/chunks/676-8018048eb217f2a19212.js","static/chunks/29107295-62449f6ab50432c0efef.js","static/chunks/821-a0eee837a5aa58606b12.js","static/chunks/701-f32a6ed8ba8f13456f21.js","static/chunks/36bcf0ca-afaab5d8fc9855302fe5.js","static/chunks/937-6948bcb00194f10fdf0a.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[354],{8354:function(t,r,e){e.d(r,{Z:function(){return d}});var n=e(19013),a=e(13882);function o(t,r){(0,a.Z)(2,arguments);var e=(0,n.Z)(t),o=(0,n.Z)(r),s=e.getTime()-o.getTime();return s<0?-1:s>0?1:s}function s(t,r){(0,a.Z)(2,arguments);var e=(0,n.Z)(t),o=(0,n.Z)(r),s=e.getFullYear()-o.getFullYear(),u=e.getMonth()-o.getMonth();return 12*s+u}function u(t){(0,a.Z)(1,arguments);var r=(0,n.Z)(t);return r.setHours(23,59,59,999),r}function i(t){(0,a.Z)(1,arguments);var r=(0,n.Z)(t),e=r.getMonth();return r.setFullYear(r.getFullYear(),e+1,0),r.setHours(23,59,59,999),r}function f(t){(0,a.Z)(1,arguments);var r=(0,n.Z)(t);return u(r).getTime()===i(r).getTime()}function c(t,r){(0,a.Z)(2,arguments);var e,u=(0,n.Z)(t),i=(0,n.Z)(r),c=o(u,i),l=Math.abs(s(u,i));if(l<1)e=0;else{1===u.getMonth()&&u.getDate()>27&&u.setDate(30),u.setMonth(u.getMonth()-c*l);var h=o(u,i)===-c;f((0,n.Z)(t))&&1===l&&1===o(t,i)&&(h=!1),e=c*(l-Number(h))}return 0===e?0:e}var l=e(70184),h=e(4958);function m(t){return function(t,r){if(null==t)throw new TypeError("assign requires that input parameter not be null or undefined");for(var e in r=r||{})Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t}({},t)}var Z=e(24262),D=1440,v=43200;function M(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,a.Z)(2,arguments);var s=e.locale||h.Z;if(!s.formatDistance)throw new RangeError("locale must contain formatDistance property");var u=o(t,r);if(isNaN(u))throw new RangeError("Invalid time value");var i,f,M=m(e);M.addSuffix=Boolean(e.addSuffix),M.comparison=u,u>0?(i=(0,n.Z)(r),f=(0,n.Z)(t)):(i=(0,n.Z)(t),f=(0,n.Z)(r));var d,g=(0,l.Z)(f,i),p=((0,Z.Z)(f)-(0,Z.Z)(i))/1e3,X=Math.round((g-p)/60);if(X<2)return e.includeSeconds?g<5?s.formatDistance("lessThanXSeconds",5,M):g<10?s.formatDistance("lessThanXSeconds",10,M):g<20?s.formatDistance("lessThanXSeconds",20,M):g<40?s.formatDistance("halfAMinute",null,M):g<60?s.formatDistance("lessThanXMinutes",1,M):s.formatDistance("xMinutes",1,M):0===X?s.formatDistance("lessThanXMinutes",1,M):s.formatDistance("xMinutes",X,M);if(X<45)return s.formatDistance("xMinutes",X,M);if(X<90)return s.formatDistance("aboutXHours",1,M);if(X<D){var b=Math.round(X/60);return s.formatDistance("aboutXHours",b,M)}if(X<2520)return s.formatDistance("xDays",1,M);if(X<v){var w=Math.round(X/D);return s.formatDistance("xDays",w,M)}if(X<86400)return d=Math.round(X/v),s.formatDistance("aboutXMonths",d,M);if((d=c(f,i))<12){var T=Math.round(X/v);return s.formatDistance("xMonths",T,M)}var x=d%12,Y=Math.floor(d/12);return x<3?s.formatDistance("aboutXYears",Y,M):x<9?s.formatDistance("overXYears",Y,M):s.formatDistance("almostXYears",Y+1,M)}function d(t,r){return(0,a.Z)(1,arguments),M(t,Date.now(),r)}}}]); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[820],{14977:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return u(3359)}])}},function(n){n.O(0,[774,888,179],(function(){return _=14977,n(n.s=_);var _}));var _=n.O();_N_E=_}]); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[255],{24887:function(e,n,t){"use strict";t.r(n),t.d(n,{FETCH_INTERVAL:function(){return N},default:function(){return k}});var r=t(15861),s=t(87757),a=t.n(s),c=t(67294),o=t(4525),i=t(60293),u=t(94853),d=t(58416),l=t(2023),f=t(8354),m=t(99382),p=t(90978),h=t(9431),g=t(85893);function x(e){var n=e.data,t=[{title:"Display Name",key:"username",render:function(e){var n=e.user,t={connectedAt:e.connectedAt,messageCount:e.messageCount,userAgent:e.userAgent};return(0,g.jsx)(m.Z,{user:n,connectionInfo:t,children:(0,g.jsx)("span",{className:"display-name",children:n.displayName})})},sorter:function(e,n){return e.user.displayName-n.user.displayName},sortDirections:["descend","ascend"]},{title:"Messages sent",dataIndex:"messageCount",key:"messageCount",className:"number-col",sorter:function(e,n){return e.messageCount-n.messageCount},sortDirections:["descend","ascend"]},{title:"Connected Time",dataIndex:"connectedAt",key:"connectedAt",defaultSortOrder:"ascend",render:function(e){return(0,f.Z)(new Date(e))},sorter:function(e,n){return new Date(e.connectedAt).getTime()-new Date(n.connectedAt).getTime()},sortDirections:["descend","ascend"]},{title:"User Agent",dataIndex:"userAgent",key:"userAgent",render:function(e){return(0,h.AB)(e)}},{title:"Location",dataIndex:"geo",key:"geo",render:function(e){return e?"".concat(e.regionName,", ").concat(e.countryCode):"-"}},{title:"",key:"block",className:"actions-col",render:function(e,n){return(0,g.jsx)(p.Z,{user:n.user,isEnabled:!n.user.disabledAt})}}];return(0,g.jsx)(l.Z,{className:"table-container",pagination:{hideOnSinglePage:!0},columns:t,dataSource:n,size:"small",rowKey:"id"})}var v=o.Z.Title,N=1e4;function k(){var e=((0,c.useContext)(i.aC)||{}).online,n=(0,c.useState)([]),t=n[0],s=n[1],o=(0,c.useState)([]),l=o[0],f=o[1],m=function(){var e=(0,r.Z)(a().mark((function e(){var n,t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,u.rQ)(u.qk);case 3:n=e.sent,s(n),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("==== error",e.t0);case 10:return e.prev=10,e.next=13,(0,u.rQ)(u.Kp);case 13:t=e.sent,f(t),e.next=20;break;case 17:e.prev=17,e.t1=e.catch(10),console.log("==== error",e.t1);case 20:case"end":return e.stop()}}),e,null,[[0,7],[10,17]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){var e;return m(),e=setInterval(m,N),function(){clearInterval(e)}}),[e]);var p=e?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(x,{data:l}),(0,g.jsxs)("p",{className:"description",children:["Visit the"," ",(0,g.jsx)("a",{href:"https://owncast.online/docs/viewers/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"documentation"})," ","to configure additional details about your viewers."]})]}):(0,g.jsx)("p",{className:"description",children:"When a stream is active and chat is enabled, connected chat clients will be displayed here."});return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(v,{children:["Connected Chat Participants ",e?"(".concat(l.length,")"):null]}),p,(0,g.jsx)("br",{}),(0,g.jsx)("br",{}),(0,g.jsx)(v,{children:"Banned Users"}),(0,g.jsx)(d.Z,{data:t})]})}},22494:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/chat/users",function(){return t(24887)}])}},function(e){e.O(0,[662,23,924,614,354,821,774,888,179],(function(){return n=22494,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[233],{75615:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return y}});var r=t(36725),o=t(1635),s=t(99683),i=t(71577),l=t(27049),a=t(85689),c=t(89281),d=t(11700),h=t(59004),x=t(2877),u=t(60106),j=t(39831),p=t(61209),f=t(50592),g=t(14182),w=t(98507),Z=t(39906),m=t(10039),b=(t(67294),t(85893));function y(){var e=[{icon:(0,b.jsx)(h.Z,{style:{fontSize:"24px"}}),title:"I want to configure my owncast instance",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/configuration/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})},{icon:(0,b.jsx)(u.Z,{style:{fontSize:"24px"}}),title:"Help configuring my broadcasting software",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/broadcasting/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})},{icon:(0,b.jsx)(j.Z,{style:{fontSize:"24px"}}),title:"I want to embed my stream into another site",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/embed/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})},{icon:(0,b.jsx)(p.Z,{style:{fontSize:"24px"}}),title:"I want to customize my website",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/website/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})},{icon:(0,b.jsx)(f.Z,{style:{fontSize:"24px"}}),title:"I want to tweak my video output",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/encoding/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})},{icon:(0,b.jsx)(g.Z,{style:{fontSize:"24px"}}),title:"I want to use an external storage provider",content:(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"https://owncast.online/docs/storage/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(x.Z,{})," Learn more"]})})}],n=[{icon:(0,b.jsx)(w.Z,{style:{fontSize:"24px"}}),title:"I found a bug",content:(0,b.jsxs)("div",{children:["If you found a bug, then please",(0,b.jsxs)("a",{href:"https://github.com/owncast/owncast/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:[" ","let us know"]})]})},{icon:(0,b.jsx)(Z.Z,{style:{fontSize:"24px"}}),title:"I have a general question",content:(0,b.jsxs)("div",{children:["Most general questions are answered in our",(0,b.jsxs)("a",{href:"https://owncast.online/docs/faq/?source=admin",target:"_blank",rel:"noopener noreferrer",children:[" ","FAQ"]})," ","or exist in our"," ",(0,b.jsx)("a",{href:"https://github.com/owncast/owncast/discussions",target:"_blank",rel:"noopener noreferrer",children:"discussions"})]})},{icon:(0,b.jsx)(m.Z,{style:{fontSize:"24px"}}),title:"I want to build add-ons for Owncast",content:(0,b.jsxs)("div",{children:["You can build your own bots, overlays, tools and add-ons with our",(0,b.jsx)("a",{href:"https://owncast.online/thirdparty?source=admin",target:"_blank",rel:"noopener noreferrer",children:"\xa0developer APIs.\xa0"})]})}];return(0,b.jsxs)("div",{className:"help-page",children:[(0,b.jsx)(d.Z,{style:{textAlign:"center"},children:"How can we help you?"}),(0,b.jsxs)(r.Z,{gutter:[16,16],justify:"space-around",align:"middle",children:[(0,b.jsxs)(o.Z,{xs:24,lg:12,style:{textAlign:"center"},children:[(0,b.jsx)(s.ZP,{status:"500"}),(0,b.jsx)(d.Z,{level:2,children:"Troubleshooting"}),(0,b.jsx)(i.Z,{target:"_blank",rel:"noopener noreferrer",href:"https://owncast.online/docs/troubleshooting/?source=admin",icon:(0,b.jsx)(x.Z,{}),type:"primary",children:"Fix your problems"})]}),(0,b.jsxs)(o.Z,{xs:24,lg:12,style:{textAlign:"center"},children:[(0,b.jsx)(s.ZP,{status:"404"}),(0,b.jsx)(d.Z,{level:2,children:"Documentation"}),(0,b.jsx)(i.Z,{target:"_blank",rel:"noopener noreferrer",href:"https://owncast.online/docs?source=admin",icon:(0,b.jsx)(x.Z,{}),type:"primary",children:"Read the Docs"})]})]}),(0,b.jsx)(l.Z,{}),(0,b.jsx)(d.Z,{level:2,children:"Common tasks"}),(0,b.jsx)(r.Z,{gutter:[16,16],children:e.map((function(e){return(0,b.jsx)(o.Z,{xs:24,lg:12,children:(0,b.jsx)(a.Z,{children:(0,b.jsx)(c.Z,{avatar:e.icon,title:e.title,description:e.content})})},e.title)}))}),(0,b.jsx)(l.Z,{}),(0,b.jsx)(d.Z,{level:2,children:"Other"}),(0,b.jsx)(r.Z,{gutter:[16,16],children:n.map((function(e){return(0,b.jsx)(o.Z,{xs:24,lg:12,children:(0,b.jsx)(a.Z,{children:(0,b.jsx)(c.Z,{avatar:e.icon,title:e.title,description:e.content})})},e.title)}))})]})}},44156:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/help",function(){return t(75615)}])}},function(e){e.O(0,[689,334,774,888,179],(function(){return n=44156,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[203],{13285:function(e,n,r){"use strict";r.d(n,{Z:function(){return d}});r(67294);var t=r(4525),i=r(60331),a=r(2023),u=r(53731),s=r(12924),o=r(85893),c=t.Z.Title;function l(e,n){var r="black";return"warning"===n.level?r="orange":"error"===n.level&&(r="red"),(0,o.jsx)(i.Z,{color:r,children:e})}function f(e){return(0,o.jsx)(u.Z,{children:e})}function d(e){var n=e.logs,r=e.pageSize;if(null===n||void 0===n||!n.length)return null;var t=[{title:"Level",dataIndex:"level",key:"level",filters:[{text:"Info",value:"info"},{text:"Warning",value:"warning"},{text:"Error",value:"Error"}],onFilter:function(e,n){return 0===n.level.indexOf(e)},render:l},{title:"Timestamp",dataIndex:"time",key:"time",render:function(e){var n=new Date(e);return(0,s.Z)(n,"pp P")},sorter:function(e,n){return new Date(e.time).getTime()-new Date(n.time).getTime()},sortDirections:["descend","ascend"],defaultSortOrder:"descend"},{title:"Message",dataIndex:"message",key:"message",render:f}];return(0,o.jsxs)("div",{className:"logs-section",children:[(0,o.jsx)(c,{children:"Logs"}),(0,o.jsx)(a.Z,{size:"middle",dataSource:n,columns:t,rowKey:function(e){return e.time},pagination:{pageSize:r||20}})]})}},25588:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return l}});var t=r(15861),i=r(87757),a=r.n(i),u=r(67294),s=r(13285),o=r(94853),c=r(85893);function l(){var e=(0,u.useState)([]),n=e[0],r=e[1],i=function(){var e=(0,t.Z)(a().mark((function e(){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,o.rQ)(o.sG);case 3:n=e.sent,r(n),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("==== error",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){var e;return setInterval(i,5e3),i(),e=setInterval(i,5e3),function(){clearInterval(e)}}),[]),(0,c.jsx)(s.Z,{logs:n,pageSize:20})}},84841:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/logs",function(){return r(25588)}])}},function(e){e.O(0,[23,924,835,774,888,179],(function(){return n=84841,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[69],{59334:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return O}});var n=t(4942),c=t(15861),a=t(87757),o=t.n(a),u=t(67294),i=t(32840),s=t(4525),l=t(2023),f=t(94853),d=t(85893);function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){(0,n.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var b=s.Z.Title;function j(e){var r=Object.values(e),t=[{title:"Name",dataIndex:"name",key:"name",render:function(e,r){return(0,d.jsx)("a",{href:r.browser_download_url,children:e})}},{title:"Size",dataIndex:"size",key:"size",render:function(e){return"".concat((e/1024/1024).toFixed(2)," MB")}}];return(0,d.jsx)(l.Z,{dataSource:r,columns:t,rowKey:function(e){return e.id},size:"large",pagination:!1})}function O(){var e=(0,u.useState)({html_url:"",name:"",created_at:null,body:"",assets:[]}),r=e[0],t=e[1],n=function(){var e=(0,c.Z)(o().mark((function e(){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,f.Kt)();case 3:r=e.sent,t(r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("==== error",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){n()}),[]),r?(0,d.jsxs)("div",{className:"upgrade-page",children:[(0,d.jsx)(b,{level:2,children:(0,d.jsx)("a",{href:r.html_url,children:r.name})}),(0,d.jsx)(b,{level:5,children:new Date(r.created_at).toDateString()}),(0,d.jsx)(i.Z,{children:r.body}),(0,d.jsx)("h3",{children:"Downloads"}),(0,d.jsx)(j,h({},r.assets))]}):null}},20014:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/upgrade",function(){return t(59334)}])}},function(e){e.O(0,[774,23,840,888,179],(function(){return r=20014,e(e.s=r);var r}));var r=e.O();_N_E=r}]); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e={},n={};function t(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={id:r,loaded:!1,exports:{}},u=!0;try{e[r].call(i.exports,i,i.exports,t),u=!1}finally{u&&delete n[r]}return i.loaded=!0,i.exports}t.m=e,function(){var e=[];t.O=function(n,r,o,i){if(!r){var u=1/0;for(l=0;l<e.length;l++){r=e[l][0],o=e[l][1],i=e[l][2];for(var a=!0,c=0;c<r.length;c++)(!1&i||u>=i)&&Object.keys(t.O).every((function(e){return t.O[e](r[c])}))?r.splice(c--,1):(a=!1,i<u&&(u=i));if(a){e.splice(l--,1);var f=o();void 0!==f&&(n=f)}}return n}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[r,o,i]}}(),t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},t.d=function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.f={},t.e=function(e){return Promise.all(Object.keys(t.f).reduce((function(n,r){return t.f[r](e,n),n}),[]))},t.u=function(e){return"static/chunks/"+e+".e602e2954bee4d3743a7.js"},t.miniCssF=function(e){return"static/css/"+{361:"daab8d18100466477c6d",888:"aa68552b8433355aec7c"}[e]+".css"},t.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},function(){var e={},n="_N_E:";t.l=function(r,o,i,u){if(e[r])e[r].push(o);else{var a,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),l=0;l<f.length;l++){var d=f[l];if(d.getAttribute("src")==r||d.getAttribute("data-webpack")==n+i){a=d;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,t.nc&&a.setAttribute("nonce",t.nc),a.setAttribute("data-webpack",n+i),a.src=r),e[r]=[o];var s=function(n,t){a.onerror=a.onload=null,clearTimeout(p);var o=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((function(e){return e(t)})),n)return n(t)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}}(),t.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},t.p="/admin/_next/",function(){var e={272:0};t.f.j=function(n,r){var o=t.o(e,n)?e[n]:void 0;if(0!==o)if(o)r.push(o[2]);else if(272!=n){var i=new Promise((function(t,r){o=e[n]=[t,r]}));r.push(o[2]=i);var u=t.p+t.u(n),a=new Error;t.l(u,(function(r){if(t.o(e,n)&&(0!==(o=e[n])&&(e[n]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;a.message="Loading chunk "+n+" failed.\n("+i+": "+u+")",a.name="ChunkLoadError",a.type=i,a.request=u,o[1](a)}}),"chunk-"+n,n)}else e[n]=0},t.O.j=function(n){return 0===e[n]};var n=function(n,r){var o,i,u=r[0],a=r[1],c=r[2],f=0;if(u.some((function(n){return 0!==e[n]}))){for(o in a)t.o(a,o)&&(t.m[o]=a[o]);if(c)var l=c(t)}for(n&&n(r);f<u.length;f++)i=u[f],t.o(e,i)&&e[i]&&e[i][0](),e[u[f]]=0;return t.O(l)},r=self.webpackChunk_N_E=self.webpackChunk_N_E||[];r.forEach(n.bind(null,0)),r.push=n.bind(null,r.push.bind(r))}()}(); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
package static |
||||
|
||||
import "embed" |
||||
|
||||
//go:embed admin/*
|
||||
//go:embed admin/_next/static
|
||||
//go:embed admin/_next/static/chunks/pages/*.js
|
||||
//go:embed admin/_next/static/*/*.js
|
||||
var adminFiles embed.FS |
||||
|
||||
// GetAdmin will return an embedded filesystem reference to the admin web app.
|
||||
func GetAdmin() embed.FS { |
||||
return adminFiles |
||||
} |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
const listenForErrors = require('./lib/errors.js').listenForErrors; |
||||
const ADMIN_USERNAME = 'admin'; |
||||
const ADMIN_PASSWORD = 'abc123'; |
||||
|
||||
describe('Video embed page', () => { |
||||
beforeAll(async () => { |
||||
await page.setViewport({ width: 1080, height: 720 }); |
||||
listenForErrors(browser, page); |
||||
|
||||
// set HTTP Basic auth
|
||||
await page.authenticate({ |
||||
username: ADMIN_USERNAME, |
||||
password: ADMIN_PASSWORD, |
||||
}); |
||||
|
||||
await page.goto('http://localhost:5309/admin'); |
||||
}); |
||||
|
||||
afterAll(async () => { |
||||
await page.waitForTimeout(3000); |
||||
await page.screenshot({ path: 'screenshots/admin.png', fullPage: true }); |
||||
}); |
||||
|
||||
it('should have rendered the admin home page', async () => { |
||||
await page.waitForSelector('.home-container'); |
||||
}); |
||||
|
||||
}); |
Loading…
Reference in new issue