Add "Hold Uploads" option to configuration
This commit is contained in:
parent
1228920004
commit
ced209a7db
@ -27,6 +27,7 @@ type Watcher struct {
|
|||||||
Path string
|
Path string
|
||||||
Username string
|
Username string
|
||||||
NoWatermark bool
|
NoWatermark bool
|
||||||
|
HoldUploads bool
|
||||||
Exclude []string
|
Exclude []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ func (ip *Processor) ThumbPNG(ul *upload.Upload, w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newXY := image.Point{}
|
newXY := image.Point{}
|
||||||
// test width
|
|
||||||
if im.Bounds().Max.X/thumbnailMaxX > im.Bounds().Max.Y/thumbnailMaxY {
|
if im.Bounds().Max.X/thumbnailMaxX > im.Bounds().Max.Y/thumbnailMaxY {
|
||||||
newXY.X = thumbnailMaxX
|
newXY.X = thumbnailMaxX
|
||||||
newXY.Y = im.Bounds().Max.Y / (im.Bounds().Max.X / thumbnailMaxX)
|
newXY.Y = im.Bounds().Max.Y / (im.Bounds().Max.X / thumbnailMaxX)
|
||||||
|
@ -83,7 +83,12 @@ func (u *Uploader) AddFile(file string, conf config.Watcher) {
|
|||||||
watermark: !conf.NoWatermark,
|
watermark: !conf.NoWatermark,
|
||||||
webhookURL: conf.WebHookURL,
|
webhookURL: conf.WebHookURL,
|
||||||
usernameOverride: conf.Username,
|
usernameOverride: conf.Username,
|
||||||
State: StatePending,
|
State: StateQueued,
|
||||||
|
}
|
||||||
|
// if the user wants uploads to be held for editing etc,
|
||||||
|
// set it to Pending instead
|
||||||
|
if conf.HoldUploads {
|
||||||
|
thisUpload.State = StatePending
|
||||||
}
|
}
|
||||||
u.Uploads = append(u.Uploads, &thisUpload)
|
u.Uploads = append(u.Uploads, &thisUpload)
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row align-items-center">
|
||||||
|
<div class="col-sm-6 my-1">
|
||||||
|
<span>Hold Uploads</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6 my-1">
|
||||||
|
<button type="button" @click="config.Watchers[i].HoldUploads = ! config.Watchers[i].HoldUploads" class="btn btn-success" x-text="watcher.HoldUploads ? 'Enabled' : 'Disabled'"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-row align-items-center">
|
<div class="form-row align-items-center">
|
||||||
<div class="col-sm-6 my-1">
|
<div class="col-sm-6 my-1">
|
||||||
@ -141,7 +150,7 @@
|
|||||||
|
|
||||||
<div class="my-5">
|
<div class="my-5">
|
||||||
<button type="button" class="btn btn-secondary" href="#"
|
<button type="button" class="btn btn-secondary" href="#"
|
||||||
@click.prevent="config.Watchers.push({Username: '', WebHookURL: 'https://webhook.url.here/', Path: '/directory/path/here', NoWatermark: false, Exclude: []});">
|
@click.prevent="config.Watchers.push({Username: '', WebHookURL: 'https://webhook.url.here/', Path: '/directory/path/here', NoWatermark: false, HoldUploads: false, Exclude: []});">
|
||||||
Add a new watcher</button>
|
Add a new watcher</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user