migrate sql:
```
ALTER TABLE posts ADD COLUMN `time` datetime NULL;
ALTER TABLE posts ADD COLUMN `title` text NULL;
ALTER TABLE posts ADD COLUMN `text` text NULL;
UPDATE posts SET
time = (SELECT a.time FROM artworks a WHERE a.id = posts.artwork_posts),
title = (SELECT a.title FROM artworks a WHERE a.id = posts.artwork_posts),
text = (SELECT a.text FROM artworks a WHERE a.id = posts.artwork_posts)
WHERE EXISTS (SELECT 1 FROM artworks a WHERE a.id = posts.artwork_posts);
ALTER TABLE artworks DROP COLUMN time;
ALTER TABLE artworks DROP COLUMN title;
ALTER TABLE artworks DROP COLUMN text;
```
configs:
add `CheckArtworkIntervalInSeconds` flag to set check artwork task interval
database:
add `migrate.sql` file
artwork:
move `time`, `title` and `text` fields to `post` schema
file:
set `id_str` and `filename` fields immutable
add `source_url` optional field
post:
set `platform` field immutable
add `time`, `title` and `text` optional from `artwork` schema
social:
set `platform` field immutable
tag:
set `text` field immutable
action(new):
add action package to create and update `file`, `post`, `social` and `tag` info
api:
artworks:
adjust GET method order option to match the database
files:
adjust GET method with `artwork/tags` edge
rename GET method respond `images` field to `files`
collect:
refactor to work with new action package
task:
artwork(new):
create `CheckArtworks` function to check and update artwork info
social:
refactor `CheckSocials` to work with new action package
router:
add `/api/task/artworks/check` endpoint for `CheckArtworks` task
src/web:
artwork noscript:
adjust order option to match the database
file noscript:
rename execute template struct `Images` field to `Files`
web:
scripts:
refactor to work with new database schema
styles:
adjust some style
use `<button>` to replace `<span>` to allow keyboard control
templates:
adjust to work with new database schema
use `<button>` to replace `<span>` to allow keyboard control
43 lines
1.5 KiB
Cheetah
43 lines
1.5 KiB
Cheetah
{{ define "mixed" }}
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>trpic</title>
|
|
<link rel="manifest" href="/manifest.json"/>
|
|
{{ "base" | .RenderStyle }}
|
|
{{ "gallery" | .RenderStyle }}
|
|
{{ "base" | .RenderScript }}
|
|
{{ "load_mixed" | .RenderScript }}
|
|
</head>
|
|
<body>
|
|
<div id="gallery">
|
|
<div id="info-box">
|
|
<p style="font-size: 1.2em; font-weight: bold;">trpic</p>
|
|
<p id="count-box" >共 <b id="count">....</b> 个作品</p>
|
|
<p>以 <select id="sort-select">
|
|
<option value="time">时间</option>
|
|
<option value="time-down">时间倒序</option>
|
|
<option value="publish">发布时间</option>
|
|
<option value="publish-down">发布时间倒序</option>
|
|
<option value="size">尺寸</option>
|
|
<option value="size-down">尺寸倒序</option>
|
|
<option value="aspect">宽高比</option>
|
|
<option value="aspect-down">宽高比倒序</option>
|
|
<option value="elongation">伸长比</option>
|
|
<option value="elongation-down">伸长比倒序</option>
|
|
</select> 排序</p>
|
|
{{ template "submit_url" . }}
|
|
<noscript>
|
|
<p>当前未启用 JavaScript</p>
|
|
<p>您可以前往 <a href="/artworks/noscript">/artworks</a> 或 <a href="/files/noscript">/files</a> 页面</p>
|
|
</noscript>
|
|
</div>
|
|
</div>
|
|
<div id="sentinel"></div>
|
|
{{ template "preview" . }}
|
|
</body>
|
|
</html>
|
|
{{ end }}
|