main
parent 4102cb8501
commit e5ce956b0c

@ -23,21 +23,18 @@
function trash(e) {
let id = e.detail.id;
let filename = e.detail.filename;
// console.log("trash image id: ", id);
axios.get(`/trash/${id}`).then((response) => {
let imgs = response.data.map((image) => {
image.selected = false;
return image;
});
// console.log("imgs: ", imgs);
images = imgs;
axios.get(`/images/trash/${id}?filename=${filename}`).then((response) => {
let status = response.data
console.log("status: ", status);
});
}
onMount(() => {
axios.get("/album/scool").then((response) => {
axios.get("/images/list").then((response) => {
images = response.data;
console.log("images: ", images);
console.log("получено images: ", images);
initTE({ Lightbox });
});
});

@ -15,10 +15,13 @@
});
}
function command_trash(id) {
function command_trash(img) {
let items = img.Url.split("/")
let filename = items[items.length-1]
dispatch('trash',
{
id: id,
id: img.Id,
filename: filename,
});
}
@ -29,9 +32,9 @@
function command_select(id) {
console.log("select: " + id);
let image = images.find((image) => image.id == id);
let image = images.find((image) => image.Id == id);
if (image) {
console.log("select image: " + image.id);
console.log("select image: " + image.Id);
image.selected = !image.selected;
} else {
console.log("selected image not found");
@ -43,15 +46,15 @@
{#each images as image}
<div class="group relative hover:bg-slate-100">
<!-- сама картинка -->
<img src={image.srct} data-te-img={image.newurl} class="img-space mb-2 w-full cursor-zoom-in data-[te-lightbox-disabled]:cursor-auto" class:p-2={image.selected} width={image.widtht} height={image.heightt} alt={image.newurl} />
<img src={image.Url} data-te-img={image.Url} class="img-space mb-2 w-full cursor-zoom-in data-[te-lightbox-disabled]:cursor-auto" class:p-2={image.selected} alt={image.Url} />
<!-- левый нижний угол (id картинки) -->
<span class="absolute invisible group-hover:visible bottom-4 left-6">{image.id}</span>
<span class="absolute invisible group-hover:visible bottom-4 left-6">{image.Id}</span>
<!-- левый верхний угол -->
<div class="flex absolute group-hover:visible top-2 left-4" class:invisible={!image.selected}>
<!-- отметка/снятие отметки -->
<button type="button" class="rounded-full" on:click={() => command_select(image.id)}>
<button type="button" class="rounded-full" on:click={() => command_select(image.Id)}>
{#if image.selected}
<svg class="p-2 w-8 h-8 fill-neutral-100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z" />
@ -77,7 +80,7 @@
<button
type="button"
class="rounded-full hover:bg-default hover:bg-primary"
on:click={() => command_trash(image.id)}
on:click={() => command_trash(image)}
>
<svg class="p-2 w-8 h-8 fill-neutral-100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path d="M170.5 51.6L151.5 80h145l-19-28.4c-1.5-2.2-4-3.6-6.7-3.6H177.1c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80H368h48 8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-8V432c0 44.2-35.8 80-80 80H112c-44.2 0-80-35.8-80-80V128H24c-13.3 0-24-10.7-24-24S10.7 80 24 80h8H80 93.8l36.7-55.1C140.9 9.4 158.4 0 177.1 0h93.7c18.7 0 36.2 9.4 46.6 24.9zM80 128V432c0 17.7 14.3 32 32 32H336c17.7 0 32-14.3 32-32V128H80zm80 64V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16z" />
@ -88,7 +91,7 @@
<button
type="button"
class="rounded-full hover:bg-default hover:bg-primary"
on:click={() => command_move(image.id)}
on:click={() => command_move(image.Id)}
>
<svg class="p-2 w-8 h-8 fill-neutral-100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path d="M400 255.4V240 208c0-8.8-7.2-16-16-16H352 336 289.5c-50.9 0-93.9 33.5-108.3 79.6c-3.3-9.4-5.2-19.8-5.2-31.6c0-61.9 50.1-112 112-112h48 16 32c8.8 0 16-7.2 16-16V80 64.6L506 160 400 255.4zM336 240h16v48c0 17.7 14.3 32 32 32h3.7c7.9 0 15.5-2.9 21.4-8.2l139-125.1c7.6-6.8 11.9-16.5 11.9-26.7s-4.3-19.9-11.9-26.7L409.9 8.9C403.5 3.2 395.3 0 386.7 0C367.5 0 352 15.5 352 34.7V80H336 304 288c-88.4 0-160 71.6-160 160c0 60.4 34.6 99.1 63.9 120.9c5.9 4.4 11.5 8.1 16.7 11.2c4.4 2.7 8.5 4.9 11.9 6.6c3.4 1.7 6.2 3 8.2 3.9c2.2 1 4.6 1.4 7.1 1.4h2.5c9.8 0 17.8-8 17.8-17.8c0-7.8-5.3-14.7-11.6-19.5l0 0c-.4-.3-.7-.5-1.1-.8c-1.7-1.1-3.4-2.5-5-4.1c-.8-.8-1.7-1.6-2.5-2.6s-1.6-1.9-2.4-2.9c-1.8-2.5-3.5-5.3-5-8.5c-2.6-6-4.3-13.3-4.3-22.4c0-36.1 29.3-65.5 65.5-65.5H304h32zM72 32C32.2 32 0 64.2 0 104V440c0 39.8 32.2 72 72 72H408c39.8 0 72-32.2 72-72V376c0-13.3-10.7-24-24-24s-24 10.7-24 24v64c0 13.3-10.7 24-24 24H72c-13.3 0-24-10.7-24-24V104c0-13.3 10.7-24 24-24h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H72z" />

@ -20,7 +20,8 @@
>
<!-- исходный альбом -->
<div class="bg-blue-300 col-span-8 h-4">
</div>
<div class="bg-green-300 col-span-4 h-4">
<AlbumSelect />
</div>
<div class="bg-green-300 col-span-4 h-4"></div>
</div>

@ -19,22 +19,22 @@ func makeAccessLog() *accesslog.AccessLog {
// Initialize a new access log middleware.
ac := accesslog.File("./access.log")
// Remove this line to disable logging to console:
ac.AddOutput(os.Stdout)
// ac.AddOutput(os.Stdout)
// The default configuration:
ac.Delim = '|'
ac.TimeFormat = "2006-01-02 15:04:05"
ac.Async = false
ac.IP = true
ac.BytesReceivedBody = true
ac.BytesSentBody = true
ac.BytesReceived = false
ac.BytesSent = false
ac.BodyMinify = true
ac.RequestBody = true
ac.ResponseBody = false
ac.KeepMultiLineError = true
ac.PanicLog = accesslog.LogHandler
// ac.Delim = '|'
// ac.TimeFormat = "2006-01-02 15:04:05"
// ac.Async = false
// ac.IP = true
// ac.BytesReceivedBody = true
// ac.BytesSentBody = true
// ac.BytesReceived = false
// ac.BytesSent = false
// ac.BodyMinify = true
// ac.RequestBody = true
// ac.ResponseBody = false
// ac.KeepMultiLineError = true
// ac.PanicLog = accesslog.LogHandler
// Default line format if formatter is missing:
// Time|Latency|Code|Method|Path|IP|Path Params Query Fields|Bytes Received|Bytes Sent|Request|Response|
@ -53,12 +53,14 @@ func makeAccessLog() *accesslog.AccessLog {
func newApp(db *sqlx.DB) *iris.Application {
app := iris.Default()
app.HandleDir("/", iris.Dir("./app/dist"))
app.HandleDir("/images/get/", iris.Dir("d:/pics"))
app.Logger().SetOutput(os.Stdout)
//imagesAPI := app.Party("/img")
//imagesAPI.Use(iris.Compression)
// app.Get("/albums", albums(db))
app.PartyFunc("/album", albums(db))
app.PartyFunc("/images", images(db))
//app.Run(iris.TLS("127.0.0.1:443", "mycert.crt", "mykey.key"))
// $ openssl req -new -newkey rsa:4096 -x509 -sha256 \
@ -106,7 +108,45 @@ func albums(db *sqlx.DB) func(iris.Party) {
albums := getAlbums(db)
ctx.JSON(albums)
})
r.Get("/get/{album}", func(ctx iris.Context) {
album := ctx.Params().Get("album")
if album == "local" {
ctx.Application().Logger().Infof("запрос локального альбома")
images := getLocalImages()
ctx.JSON(images)
} else {
ctx.Application().Logger().Infof("запрос альбома: %s", album)
ctx.JSON(iris.Map{"message": "hello", "status": iris.StatusOK})
}
})
}
}
func images(db *sqlx.DB) func(iris.Party) {
return func(r iris.Party) {
r.Get("/list", func(ctx iris.Context) {
ctx.Application().Logger().Infof("запрос списка картинок")
images := getLocalImages()
ctx.JSON(images)
})
r.Get("/trash/{id}", func(ctx iris.Context) {
id := ctx.Params().Get("id")
filename := ctx.Request().URL.Query().Get("filename")
ctx.Application().Logger().Infof("удаление картинки[%s]: %s", id, filename)
ctx.JSON(iris.Map{"filename": filename})
})
}
}
func getLocalImages() []Image {
images := []Image{}
list, err := os.ReadDir("d:/pics")
checkError("read dir", err)
for n, f := range list {
img := Image{Id: n, Url: "/images/get/" + f.Name()}
images = append(images, img)
}
return images
}
type Image struct {

@ -1,32 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIFezCCA2OgAwIBAgIUBbzVC72lEOMsMe54lVPVN2HZEk0wDQYJKoZIhvcNAQEL
BQAwTTELMAkGA1UEBhMCUlUxEzARBgNVBAgMClNvbWUtU3RhdGUxDDAKBgNVBAcM
A1VmYTENMAsGA1UECgwEaG9tZTEMMAoGA1UEAwwDdGFkMB4XDTI0MDEzMDEyMzcx
NFoXDTI1MDEyOTEyMzcxNFowTTELMAkGA1UEBhMCUlUxEzARBgNVBAgMClNvbWUt
U3RhdGUxDDAKBgNVBAcMA1VmYTENMAsGA1UECgwEaG9tZTEMMAoGA1UEAwwDdGFk
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9pgpUsZJSUZ5K0NKSTSz
ZLMzP1WXYSg2x+3+2hV4szH/53NZFqx7AlQQtD6kBhHf6ASUMcT7bazTlz+DTeZZ
qenRSO+xnvW9cfhBbZF8QWmISaqLIlkLduqjuv3Q1J/f28E47KPQiJIebBHkYBNV
6OLshRVU/VUzkINAWSRY2dk1vACRE74GEhYVIakUUYJoWvd+vBBfXMacKJDv5aUD
kPxrPDGwv5/jUHpwiYpU333NAViJ2D8Ai6AQbS1aHay1ceyGZ25nDyikz7plkMMF
Snr4Hhy4KZR+29O5+3RGAnAMwlQWlTeydXxcRO4S2ZRCwxLiMJ08NZTFRA3IyNTF
HqO410Q0CzaewZoNMct6Q83BL3SHNXkIlKOeL/90rB2bjOvZp+Tog+yCUbAYG0K1
fKf2yVfIBg2XHlMqqDkn7LI20bf3Kfe0d8xdafdqTq2ffyUGJuUZ+xGp/+MBVq1E
ESxMXAFzr0h8LHrxFTuriZC4del6sR5FdE9jKqtUpFQ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qe1FSksWxTU4Zb4GEA==
-----END PRIVATE KEY-----

@ -1,4 +0,0 @@
1706685145769,0s,404,GET,/album/scool,127.0.0.1,0,-1
1706685147112,579.1µs,304,GET,/,127.0.0.1,0,-1
1706685147144,908.5µs,404,GET,/album/scool,127.0.0.1,0,-1
1706685148780,205.1804ms,200,GET,/album/list,127.0.0.1,0,3021
Loading…
Cancel
Save