Documentation
¶
Index ¶
- Constants
- Variables
- func HTTPJSON(hw http.ResponseWriter, code int, obj any)
- func SendHTTPError(hw http.ResponseWriter, code int, err error)
- type AddJobURL
- type HTTPError
- type Job
- func (job *Job) Button() jaws.ClickHandler
- func (job *Job) Close()
- func (job *Job) DocumentName() (s string)
- func (job *Job) HasMeta() (yes bool)
- func (job *Job) Lang() (s string)
- func (job *Job) MaxUploadSize() (n int64)
- func (job *Job) MetaPath() string
- func (job *Job) Preview(numPages, imgWidth int) (b []byte, err error)
- func (job *Job) Previewable() (yes bool)
- func (job *Job) ResultName() (s string)
- func (job *Job) ResultPath() string
- func (job *Job) Start() (err error)
- func (job *Job) State() (state JobState)
- func (job *Job) Stopped() (t time.Time)
- func (job *Job) UiJobMeta() jaws.Updater
- func (job *Job) UiJobPreview() jaws.Updater
- func (job *Job) UiLink() jaws.HtmlGetter
- func (job *Job) UiStatus() (ui jaws.HtmlGetter)
- type JobState
- type Rinse
- func (rns *Rinse) AddJob(job *Job) (err error)
- func (rns *Rinse) AuthFn(fn http.HandlerFunc) http.Handler
- func (rns *Rinse) CleanupSec() (n int)
- func (rns *Rinse) Close()
- func (rns *Rinse) FindJob(s string) *Job
- func (rns *Rinse) FormFileKey() string
- func (rns *Rinse) FormLangKey() string
- func (rns *Rinse) FormURLKey() string
- func (rns *Rinse) GetEmail(hr *http.Request) (s string)
- func (rns *Rinse) GetExternalIP() (publicip string, err error)
- func (rns *Rinse) IsAdmin(email string) (yes bool)
- func (rns *Rinse) IsAdminRequest(hr *http.Request) (yes bool)
- func (rns *Rinse) IsClosed() (yes bool)
- func (rns *Rinse) JawsContains(e *jaws.Element) (contents []jaws.UI)
- func (rns *Rinse) JobList(email string) (jobs []*Job)
- func (rns *Rinse) LanguageName(code string) string
- func (rns *Rinse) MaxConcurrent() (n int)
- func (rns *Rinse) MaxTimeSec() (n int)
- func (rns *Rinse) MaybeStartJob() (err error)
- func (rns *Rinse) PkgName() string
- func (rns *Rinse) PkgVersion() string
- func (rns *Rinse) RESTDELETEJobsUUID(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RESTGETJobs(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RESTGETJobsUUID(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RESTGETJobsUUIDMeta(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RESTGETJobsUUIDPreview(w http.ResponseWriter, r *http.Request)
- func (rns *Rinse) RESTGETJobsUUIDRinsed(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RESTPOSTJobs(hw http.ResponseWriter, hr *http.Request)
- func (rns *Rinse) RemoveJob(job *Job)
- func (rns *Rinse) SettingsFile() string
- func (rns *Rinse) UiAdmins() jaws.ClickHandler
- func (rns *Rinse) UiAutoCleanup() jaws.HtmlGetter
- func (rns *Rinse) UiCleanupGotten() jaws.BoolSetter
- func (rns *Rinse) UiClock() jaws.HtmlGetter
- func (rns *Rinse) UiExternalIP() (ui jaws.HtmlGetter)
- func (rns *Rinse) UiImpersonate() jaws.ClickHandler
- func (rns *Rinse) UiMaxConcurrent() jaws.HtmlGetter
- func (rns *Rinse) UiMaxRuntime() jaws.HtmlGetter
- func (rns *Rinse) UiMaxSize() jaws.HtmlGetter
- func (rns *Rinse) UiNavLink(rq *http.Request, url, title string) template.HTML
- func (rns *Rinse) UiProxy() jaws.StringSetter
- func (rns *Rinse) UiUser() jaws.HtmlGetter
- func (rns *Rinse) UpdateExternalIP()
Constants ¶
View Source
const FormFileKey = "file"
View Source
const FormLangKey = "lang"
View Source
const FormURLKey = "url"
View Source
const WorkerImage = "ghcr.io/linkdata/rinseworker"
Variables ¶
View Source
var ErrContentEncoded = errors.New("Content-Encoding is set")
View Source
var ErrDocumentTooLarge = errors.New("document too large")
View Source
var ErrDuplicateUUID = errors.New("duplicate UUID")
View Source
var ErrIllegalLanguage = errors.New("illegal language string")
View Source
var ErrIllegalURLScheme = errors.New("illegal URL scheme")
View Source
var ErrImageSeenTwice = errors.New("image file seen twice")
View Source
var ErrMissingDocument = errors.New("no document found")
View Source
var ErrMultipleDocuments = errors.New("multiple documents found")
View Source
var ErrWorkerRootDirNotFound = errors.New("/opt/rinseworker not found")
View Source
var LanguageCode = map[string]string{}/* 103 elements not displayed */
View Source
var LanguageTika = map[string]string{
"da": "dan",
"de": "deu",
"et": "est",
"el": "ell",
"en": "eng",
"es": "spa",
"fi": "fin",
"fr": "fra",
"hu": "hun",
"is": "isl",
"it": "ita",
"nl": "nld",
"no": "nor",
"pl": "pol",
"pt": "por",
"ru": "rus",
"sv": "swe",
"th": "tha",
}
Functions ¶
func SendHTTPError ¶
func SendHTTPError(hw http.ResponseWriter, code int, err error)
Types ¶
type AddJobURL ¶
type AddJobURL struct {
URL string `json:"url" example:"https://getsamplefiles.com/download/pdf/sample-1.pdf"`
Lang string `json:"lang" example:"auto"`
MaxSizeMB int `json:"maxsizemb" example:"2048"`
MaxTimeSec int `json:"maxtimesec" example:"3600"`
CleanupSec int `json:"cleanupsec" example:"86400"`
CleanupGotten bool `json:"cleanupgotten" example:"true"`
Private bool `json:"private" example:"false"`
}
type Job ¶
type Job struct {
Rinse *Rinse `json:"-"`
Workdir string `json:"workdir" example:"/tmp/rinse-550e8400-e29b-41d4-a716-446655440000"`
Datadir string `json:"-"`
Name string `json:"name" example:"example.docx"`
Created time.Time `json:"created" example:"2024-01-01T12:00:00+00:00" format:"dateTime"`
UUID uuid.UUID `json:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" format:"uuid"`
MaxSizeMB int `json:"maxsizemb" example:"2048"`
MaxTimeSec int `json:"maxtimesec" example:"600"`
CleanupSec int `json:"cleanupsec" example:"600"`
CleanupGotten bool `json:"cleanupgotten" example:"true"`
Private bool `json:"private" example:"false"`
Email string `json:"email,omitempty" example:"user@example.com"`
Error error `json:"error,omitempty"`
PdfName string `json:"pdfname,omitempty" example:"example-docx-rinsed.pdf"` // rinsed PDF file name
Language string `json:"lang,omitempty" example:"auto"`
Done bool `json:"done,omitempty" example:"false"`
Diskuse int64 `json:"diskuse,omitempty" example:"1234"`
Pages int `json:"pages,omitempty" example:"1"`
Downloads int // `json:"downloads,omitempty" example:"0"`
// contains filtered or unexported fields
}
func (*Job) Button ¶
func (job *Job) Button() jaws.ClickHandler
func (*Job) DocumentName ¶
func (*Job) MaxUploadSize ¶
func (*Job) Previewable ¶
func (*Job) ResultName ¶
func (*Job) ResultPath ¶
func (*Job) UiJobPreview ¶
func (*Job) UiLink ¶
func (job *Job) UiLink() jaws.HtmlGetter
func (*Job) UiStatus ¶
func (job *Job) UiStatus() (ui jaws.HtmlGetter)
type Rinse ¶
type Rinse struct {
Config *webserv.Config
Jaws *jaws.Jaws
JawsAuth *jawsauth.Server
RunscBin string
RootDir string
FaviconURI string
Languages []string
OAuth2Settings jawsauth.Config
// contains filtered or unexported fields
}
func (*Rinse) CleanupSec ¶
func (*Rinse) FormFileKey ¶
func (*Rinse) FormLangKey ¶
func (*Rinse) FormURLKey ¶
func (*Rinse) GetExternalIP ¶
func (*Rinse) IsAdminRequest ¶ added in v0.14.0
func (*Rinse) JawsContains ¶
JawsContains implements jaws.Container.
func (*Rinse) LanguageName ¶
func (*Rinse) MaxConcurrent ¶
func (*Rinse) MaxTimeSec ¶
func (*Rinse) MaybeStartJob ¶
func (*Rinse) PkgVersion ¶
func (*Rinse) RESTDELETEJobsUUID ¶
func (rns *Rinse) RESTDELETEJobsUUID(hw http.ResponseWriter, hr *http.Request)
RESTDELETEJobsUUID godoc
@Summary Delete a job
@Description Delete by job UUID
@Tags jobs
@Accept */*
@Produce json
@Param uuid path string true "49d1e304-d2b8-46bf-b6a6-f1e9b797e1b0"
@Success 200 {object} Job
@Failure 404 {object} HTTPError
@Router /jobs/{uuid} [delete]
func (*Rinse) RESTGETJobs ¶
func (rns *Rinse) RESTGETJobs(hw http.ResponseWriter, hr *http.Request)
RESTGETJobs godoc
@Summary List jobs
@Description Get a list of all jobs.
@Tags jobs
@Accept */*
@Produce json
@Success 200 {array} Job
@Router /jobs [get]
func (*Rinse) RESTGETJobsUUID ¶
func (rns *Rinse) RESTGETJobsUUID(hw http.ResponseWriter, hr *http.Request)
RESTGETJobsUUID godoc
@Summary Get job metadata.
@Description Get job metadata by UUID.
@Tags jobs
@Accept json
@Produce json
@Param uuid path string true "49d1e304-d2b8-46bf-b6a6-f1e9b797e1b0"
@Success 200 {object} Job
@Failure 404 {object} HTTPError
@Router /jobs/{uuid} [get]
func (*Rinse) RESTGETJobsUUIDMeta ¶
func (rns *Rinse) RESTGETJobsUUIDMeta(hw http.ResponseWriter, hr *http.Request)
RESTGETJobsUUIDMeta godoc
@Summary Get the jobs document metadata.
@Description Get the jobs document metadata.
@Tags jobs
@Accept */*
@Produce json
@Param uuid path string true "49d1e304-d2b8-46bf-b6a6-f1e9b797e1b0"
@Success 200 {file} file ""
@Success 202 {object} Job "Metadata not yet ready."
@Failure 404 {object} HTTPError
@Failure 410 {object} HTTPError "Job failed."
@Failure 500 {object} HTTPError
@Router /jobs/{uuid}/meta [get]
func (*Rinse) RESTGETJobsUUIDPreview ¶
func (rns *Rinse) RESTGETJobsUUIDPreview(w http.ResponseWriter, r *http.Request)
RESTGETJobsUUIDPreview godoc
@Summary Show a job preview image
@Description show job preview image by UUID
@Tags jobs
@Accept */*
@Produce html
@Produce jpeg
@Param uuid path string true "49d1e304-d2b8-46bf-b6a6-f1e9b797e1b0"
@Param pages query int false "1"
@Param width query int false "172"
@Success 200 {html} html ""
@Success 200 {jpeg} jpeg ""
@Success 202 {object} Job "Preview not yet ready."
@Failure 400 {object} HTTPError
@Failure 404 {object} HTTPError
@Failure 410 {object} HTTPError "Job failed."
@Failure 500 {object} HTTPError
@Router /jobs/{uuid}/preview [get]
func (*Rinse) RESTGETJobsUUIDRinsed ¶
func (rns *Rinse) RESTGETJobsUUIDRinsed(hw http.ResponseWriter, hr *http.Request)
RESTGETJobsUUIDRinsed godoc
@Summary Get the jobs rinsed document.
@Description Get the jobs rinsed document.
@Tags jobs
@Accept */*
@Produce application/pdf
@Produce json
@Param uuid path string true "49d1e304-d2b8-46bf-b6a6-f1e9b797e1b0"
@Success 200 {file} file ""
@Success 202 {object} Job "Rinsed version not yet ready."
@Failure 404 {object} HTTPError
@Failure 410 {object} HTTPError "Job failed."
@Failure 500 {object} HTTPError
@Router /jobs/{uuid}/rinsed [get]
func (*Rinse) RESTPOSTJobs ¶
func (rns *Rinse) RESTPOSTJobs(hw http.ResponseWriter, hr *http.Request)
RESTPOSTJobs godoc
@Summary Add a job
@Description Add job with either a file using multipart/form-data or a URL using json.
@Tags jobs
@Accept json
@Accept multipart/form-data
@Produce json
@Param addjoburl body AddJobURL false "Add job by URL"
@Param file formData file false "this is a test file"
@Param lang query string false "eng"
@Param maxsizemb query int false "2048"
@Param maxtimesec query int false "600"
@Param cleanupsec query int false "600"
@Param cleanupgotten query bool false "true"
@Param private query bool false "false"
@Success 200 {object} Job
@Failure 400 {object} HTTPError
@Failure 404 {object} HTTPError
@Failure 415 {object} HTTPError
@Failure 500 {object} HTTPError
@Router /jobs [post]
func (*Rinse) SettingsFile ¶
func (*Rinse) UiAdmins ¶
func (rns *Rinse) UiAdmins() jaws.ClickHandler
func (*Rinse) UiAutoCleanup ¶
func (rns *Rinse) UiAutoCleanup() jaws.HtmlGetter
func (*Rinse) UiCleanupGotten ¶
func (rns *Rinse) UiCleanupGotten() jaws.BoolSetter
func (*Rinse) UiClock ¶
func (rns *Rinse) UiClock() jaws.HtmlGetter
func (*Rinse) UiExternalIP ¶
func (rns *Rinse) UiExternalIP() (ui jaws.HtmlGetter)
func (*Rinse) UiImpersonate ¶
func (rns *Rinse) UiImpersonate() jaws.ClickHandler
func (*Rinse) UiMaxConcurrent ¶
func (rns *Rinse) UiMaxConcurrent() jaws.HtmlGetter
func (*Rinse) UiMaxRuntime ¶
func (rns *Rinse) UiMaxRuntime() jaws.HtmlGetter
func (*Rinse) UiMaxSize ¶
func (rns *Rinse) UiMaxSize() jaws.HtmlGetter
func (*Rinse) UiProxy ¶
func (rns *Rinse) UiProxy() jaws.StringSetter
func (*Rinse) UiUser ¶
func (rns *Rinse) UiUser() jaws.HtmlGetter
func (*Rinse) UpdateExternalIP ¶
func (rns *Rinse) UpdateExternalIP()
Source Files
¶
- addjoburl.go
- errorhtml.go
- findjob.go
- handlepost.go
- httpbind.go
- httperror.go
- httpjson.go
- job.go
- jobpreview.go
- jobprocess.go
- langcodes.go
- prettybytesize.go
- prettyduration.go
- restdeletejobs.go
- restgetjobs.go
- restgetjobsuuid.go
- restgetjobsuuidmeta.go
- restgetjobsuuidpreview.go
- restgetjobsuuidrinsed.go
- restpostjobs.go
- rinse.go
- runsc.go
- scrubfile.go
- settings.go
- uiadmins.go
- uiautocleanup.go
- uicleanupgotten.go
- uiclock.go
- uiexternalip.go
- uiimpersonate.go
- uijobbutton.go
- uijoblink.go
- uijobmeta.go
- uijobpreview.go
- uijobstatus.go
- uimaxconcurrent.go
- uimaxruntime.go
- uimaxsize.go
- uinavlink.go
- uiproxy.go
- uiuser.go
Click to show internal directories.
Click to hide internal directories.