Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6fc2e46ac | ||
|
|
2ca065894d | ||
|
|
9331573890 | ||
|
|
85aa3fc5b1 | ||
|
|
cf4d419e52 | ||
|
|
810de0cb24 | ||
|
|
e68f7407f3 | ||
|
|
ad436f786c | ||
|
|
a2649fddeb | ||
|
|
f69f76a05a | ||
|
|
1a75dec59a | ||
|
|
663ceaca16 | ||
|
|
22d2484cab | ||
|
|
1af7415add | ||
|
|
71177f749c | ||
|
|
bbfa5b28c3 | ||
|
|
ba11eda64c | ||
|
|
174ec31351 | ||
|
|
27ecdf386e | ||
|
|
5e633b959d | ||
|
|
a4df094191 | ||
|
|
15c88fc6be | ||
|
|
ddca7acbd4 | ||
|
|
fd655952b6 | ||
|
|
b672b1cefa | ||
|
|
f2953dd18f | ||
|
|
0c4274d87b | ||
|
|
4a2a84b36f | ||
|
|
3944c6a4b0 | ||
|
|
a352e359c4 | ||
|
|
d9ca806d50 | ||
|
|
f037522052 | ||
|
|
e476117c77 | ||
|
|
d758f5bf12 | ||
|
|
8b2c4310ba | ||
|
|
1c24b9a23f | ||
|
|
86758cf848 | ||
|
|
39d75eddbd | ||
|
|
f4ee40f45d | ||
|
|
422078545e | ||
|
|
2a7cb467cf | ||
|
|
c20ab45c9d | ||
|
|
cf625abff2 | ||
|
|
85977cb7af | ||
|
|
2032837aad | ||
|
|
a097cf4311 | ||
|
|
bf7fb937d2 | ||
|
|
a8ce5490c8 | ||
|
|
b0b0347b04 | ||
|
|
a75712a60a | ||
|
|
e08b6121a2 |
@@ -1,10 +1,9 @@
|
|||||||
# main: tests only.
|
# main: tests and image build (tags: commit hash, `main`).
|
||||||
# prod: tests, image build (tags: commit hash, `prod`, `latest`), then
|
# prod: the same, then deployment to the server (tags: commit hash, `prod`, `latest`).
|
||||||
# deployment to the server.
|
|
||||||
#
|
#
|
||||||
# Runs on the self-hosted runner in ci/runner (label `linux`), one job at a
|
# Runs on the self-hosted runner in ci/runner (label `linux`). Jobs use the
|
||||||
# time; building on main too would build every deployed commit twice. Jobs use
|
# host's Docker daemon, so image builds share its BuildKit cache; a commit
|
||||||
# the host's Docker daemon, so image builds share its BuildKit cache.
|
# already built on main is rebuilt from cache in seconds.
|
||||||
#
|
#
|
||||||
# Repository settings (Settings → Actions):
|
# Repository settings (Settings → Actions):
|
||||||
# secrets.REGISTRY_TOKEN Gitea access token with package write access
|
# secrets.REGISTRY_TOKEN Gitea access token with package write access
|
||||||
@@ -64,7 +63,6 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: test
|
needs: test
|
||||||
if: github.ref == 'refs/heads/prod'
|
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ pub fn tarot_schema() -> Value {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"synthesis": {"type": "string", "description": "How the cards read together (a single card: how its message shows in practice), 1-3 paragraphs separated by a blank line"},
|
"synthesis": {"type": "string", "description": "How the cards read together, 1-3 paragraphs separated by a blank line"},
|
||||||
"advice": {"type": "string", "description": "A closing, encouraging paragraph with one or two concrete steps"}
|
"advice": {"type": "string", "description": "A closing, encouraging paragraph with one or two concrete steps"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -281,13 +281,6 @@ fn length(cards: usize) -> (usize, usize) {
|
|||||||
|
|
||||||
fn hungarian_system(cards: usize) -> String {
|
fn hungarian_system(cards: usize) -> String {
|
||||||
let (min, max) = length(cards);
|
let (min, max) = length(cards);
|
||||||
let together = if cards == 1 {
|
|
||||||
"- Egyetlen lap van, nincs mit egymáshoz mérni: a „synthesis” mezőben arról írj, hogyan jelenhet meg a lap \
|
|
||||||
üzenete a gyakorlatban, az olvasó napjában vagy a kérdése ügyében (helyzetek, érzések, amelyekre figyelhet)."
|
|
||||||
} else {
|
|
||||||
"- A lapok együtt mesélnek: mutasd meg, hogyan kapcsolódnak egymáshoz (ismétlődő elemek, színek, nagy árkánumok \
|
|
||||||
súlya, az álló és fordított lapok aránya)."
|
|
||||||
};
|
|
||||||
format!(
|
format!(
|
||||||
"Tapasztalt, empatikus, lélektani szemléletű tarot-olvasó vagy, aki az asztrológiát is ismeri. A Sorsfonalak \
|
"Tapasztalt, empatikus, lélektani szemléletű tarot-olvasó vagy, aki az asztrológiát is ismeri. A Sorsfonalak \
|
||||||
alkalmazás számára személyes kártyajóslást írsz egy kirakásról, amelyet az olvasó kérdésére húzott.
|
alkalmazás számára személyes kártyajóslást írsz egy kirakásról, amelyet az olvasó kérdésére húzott.
|
||||||
@@ -299,7 +292,8 @@ Szabályok:
|
|||||||
kiindulópont: a saját tudásod a lapok hagyományos szimbolikájáról (Rider–Waite) kiegészítheti, de ne mondjon neki ellent.
|
kiindulópont: a saját tudásod a lapok hagyományos szimbolikájáról (Rider–Waite) kiegészítheti, de ne mondjon neki ellent.
|
||||||
- Minden lapot a pozíciója fényében olvass, és mindig a kérdésre vonatkoztasd. Ha nincs kérdés, az olvasó jelenlegi \
|
- Minden lapot a pozíciója fényében olvass, és mindig a kérdésre vonatkoztasd. Ha nincs kérdés, az olvasó jelenlegi \
|
||||||
életszakaszáról szólj általánosan.
|
életszakaszáról szólj általánosan.
|
||||||
{together}
|
- A lapok együtt mesélnek: mutasd meg, hogyan kapcsolódnak egymáshoz (ismétlődő elemek, színek, nagy árkánumok \
|
||||||
|
súlya, az álló és fordított lapok aránya).
|
||||||
- Az olvasó Napját, Holdját és Aszcendensét (ha meg van adva) egy-két helyen, finoman kapcsold a lapokhoz, például a \
|
- Az olvasó Napját, Holdját és Aszcendensét (ha meg van adva) egy-két helyen, finoman kapcsold a lapokhoz, például a \
|
||||||
lapok elemén vagy asztrológiai megfelelésén keresztül; ne írj belőle horoszkópot.
|
lapok elemén vagy asztrológiai megfelelésén keresztül; ne írj belőle horoszkópot.
|
||||||
- Közvetlenül az olvasóhoz szólj, tegező formában (egyes szám második személyben, „te”).
|
- Közvetlenül az olvasóhoz szólj, tegező formában (egyes szám második személyben, „te”).
|
||||||
@@ -319,13 +313,6 @@ elem legyen, ahány lap van, a pozíciók sorrendjében.{HUNGARIAN_TERMS}"
|
|||||||
|
|
||||||
fn english_system(language: &str, cards: usize) -> String {
|
fn english_system(language: &str, cards: usize) -> String {
|
||||||
let (min, max) = length(cards);
|
let (min, max) = length(cards);
|
||||||
let together = if cards == 1 {
|
|
||||||
"- There is a single card, nothing to weigh it against: in \"synthesis\" write how its message may show in \
|
|
||||||
practice, in the reader's day or in the matter of the question (situations and feelings to watch for)."
|
|
||||||
} else {
|
|
||||||
"- Show how the cards tell one story together (recurring elements and suits, the weight of the major arcana, \
|
|
||||||
upright versus reversed cards)."
|
|
||||||
};
|
|
||||||
format!(
|
format!(
|
||||||
"You are an experienced, empathetic tarot reader with a psychological approach who also knows astrology. You \
|
"You are an experienced, empathetic tarot reader with a psychological approach who also knows astrology. You \
|
||||||
write a personal tarot reading for the Sorsfonalak app about a spread the reader drew for their question.
|
write a personal tarot reading for the Sorsfonalak app about a spread the reader drew for their question.
|
||||||
@@ -337,7 +324,8 @@ Rules:
|
|||||||
starting point; your knowledge of the traditional (Rider-Waite) symbolism may add to them but must not contradict them.
|
starting point; your knowledge of the traditional (Rider-Waite) symbolism may add to them but must not contradict them.
|
||||||
- Read each card in the light of its position and always relate it to the question. Without a question, speak about \
|
- Read each card in the light of its position and always relate it to the question. Without a question, speak about \
|
||||||
the reader's present phase of life.
|
the reader's present phase of life.
|
||||||
{together}
|
- Show how the cards tell one story together (recurring elements and suits, the weight of the major arcana, upright \
|
||||||
|
versus reversed cards).
|
||||||
- Link the reader's Sun, Moon and Ascendant (when given) to the cards once or twice, gently, e.g. through the cards' \
|
- Link the reader's Sun, Moon and Ascendant (when given) to the cards once or twice, gently, e.g. through the cards' \
|
||||||
elements or astrological correspondences; do not write a horoscope.
|
elements or astrological correspondences; do not write a horoscope.
|
||||||
- Address the reader directly, in the second person.
|
- Address the reader directly, in the second person.
|
||||||
@@ -477,13 +465,6 @@ mod tests {
|
|||||||
assert!(Reading::parse(&json!({"spread": "daily", "cards": [{"card": "nincs"}]})).is_err());
|
assert!(Reading::parse(&json!({"spread": "daily", "cards": [{"card": "nincs"}]})).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn one_card_has_no_reading_together() {
|
|
||||||
assert!(hungarian_system(1).contains("Egyetlen lap van") && !hungarian_system(1).contains("együtt mesélnek"));
|
|
||||||
assert!(hungarian_system(3).contains("együtt mesélnek"));
|
|
||||||
assert!(english_system("en", 1).contains("single card") && !english_system("en", 1).contains("one story"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_one_card_answer_is_valid() {
|
fn a_one_card_answer_is_valid() {
|
||||||
let text = "Egy bekezdés a lapról.";
|
let text = "Egy bekezdés a lapról.";
|
||||||
|
|||||||
+3
-5
@@ -2,15 +2,13 @@
|
|||||||
|
|
||||||
A `.gitea/workflows/ci.yml` (Gitea Actions) két ágra fut:
|
A `.gitea/workflows/ci.yml` (Gitea Actions) két ágra fut:
|
||||||
|
|
||||||
- **main**: csak tesztek.
|
- **main**: tesztek, majd image-build. Címkék: a commit hash első 12 karaktere és `main`.
|
||||||
- **prod**: tesztek, image-build, majd telepítés a szerverre. Címkék: a commit hash első 12 karaktere, `prod` és `latest`. Élesíteni tehát úgy kell, hogy a main-t a prod-ba mergeled (vagy pusholod).
|
- **prod**: ugyanez, majd telepítés a szerverre. Címkék: hash, `prod` és `latest`. Élesíteni tehát úgy kell, hogy a main-t a prod-ba mergeled (vagy pusholod).
|
||||||
|
|
||||||
A runner egyszerre egy feladatot futtat; ha a main is buildelne, minden kitett commit kétszer épülne, és a két futás feladatai egymás közé ékelődnének. A fordítási hibák (például a frontend TypeScript-ellenőrzése) így a prod buildben derülnek ki, ezért kitétel előtt helyben is érdemes buildelni.
|
|
||||||
|
|
||||||
A lépések:
|
A lépések:
|
||||||
|
|
||||||
1. **test**: `cargo test` a backendre, a workerre, a db-re, a horoscope-clientre és a service-kitre, egy Postgres szolgáltatás-konténerrel.
|
1. **test**: `cargo test` a backendre, a workerre, a db-re, a horoscope-clientre és a service-kitre, egy Postgres szolgáltatás-konténerrel.
|
||||||
2. **build** (csak prod): megépíti a négy image-et, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-<szolgáltatás>` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi.
|
2. **build**: megépíti a négy image-et, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-<szolgáltatás>` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi. Egy main-en már megépült commit a cache-ből pár mp alatt újraépül.
|
||||||
3. **deploy** (csak prod): felmásolja a `docker-compose.yml`-t és a `Caddyfile`-t a szerverre, beírja az új `TAG`-et a szerveren lévő `.env`-be, majd `docker compose pull && up -d`. Az adatbázis-migrációk a backend indulásakor futnak le.
|
3. **deploy** (csak prod): felmásolja a `docker-compose.yml`-t és a `Caddyfile`-t a szerverre, beírja az új `TAG`-et a szerveren lévő `.env`-be, majd `docker compose pull && up -d`. Az adatbázis-migrációk a backend indulásakor futnak le.
|
||||||
4. **release** (csak prod, a deploy után): létrehoz egy `v<év.hónap.nap>-<hash>` taget és Gitea-release-t az előző release óta bekerült commitok listájával (repó → Releases).
|
4. **release** (csak prod, a deploy után): létrehoz egy `v<év.hónap.nap>-<hash>` taget és Gitea-release-t az előző release óta bekerült commitok listájával (repó → Releases).
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ export function TarotResult({
|
|||||||
question: string | null;
|
question: string | null;
|
||||||
content: TarotContent;
|
content: TarotContent;
|
||||||
}) {
|
}) {
|
||||||
// A single card has nothing to read it with: its synthesis is about everyday life.
|
|
||||||
const together = cards.length === 1 ? "A gyakorlatban" : "A lapok együtt";
|
|
||||||
return (
|
return (
|
||||||
<article className="tarot-result">
|
<article className="tarot-result">
|
||||||
<header className="tarot-result-head">
|
<header className="tarot-result-head">
|
||||||
@@ -53,8 +51,8 @@ export function TarotResult({
|
|||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
{content.synthesis && (
|
{content.synthesis && (
|
||||||
<section className="tarot-synthesis" aria-label={together}>
|
<section className="tarot-synthesis" aria-label="A lapok együtt">
|
||||||
<h3>{together}</h3>
|
<h3>A lapok együtt</h3>
|
||||||
<Paragraphs text={content.synthesis} />
|
<Paragraphs text={content.synthesis} />
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -50,12 +50,10 @@ export function TarotTable({
|
|||||||
const [spread, setSpread] = useState<SpreadId>("trinity");
|
const [spread, setSpread] = useState<SpreadId>("trinity");
|
||||||
const [topic, setTopic] = useState<TopicId>("general");
|
const [topic, setTopic] = useState<TopicId>("general");
|
||||||
const [question, setQuestion] = useState("");
|
const [question, setQuestion] = useState("");
|
||||||
// A reading still being written is shown on the table, not the form for a new one.
|
const [phase, setPhase] = useState<Phase>("setup");
|
||||||
const inProgress = initialReadings.find((r) => r.status === "pending" || r.status === "running") ?? null;
|
|
||||||
const [phase, setPhase] = useState<Phase>(inProgress ? "done" : "setup");
|
|
||||||
const [picked, setPicked] = useState<number[]>([]);
|
const [picked, setPicked] = useState<number[]>([]);
|
||||||
const [current, setCurrent] = useState<TarotReading | null>(inProgress);
|
const [current, setCurrent] = useState<TarotReading | null>(null);
|
||||||
const [revealed, setRevealed] = useState(inProgress?.cards.length ?? 0);
|
const [revealed, setRevealed] = useState(0);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [buying, setBuying] = useState(false);
|
const [buying, setBuying] = useState(false);
|
||||||
|
|
||||||
@@ -245,9 +243,7 @@ export function TarotTable({
|
|||||||
? "A lapok…"
|
? "A lapok…"
|
||||||
: "A kirakásod"}
|
: "A kirakásod"}
|
||||||
</h2>
|
</h2>
|
||||||
{(current ? current.question : question.trim()) && (
|
{question.trim() && <p className="tarot-question">„{question.trim()}”</p>}
|
||||||
<p className="tarot-question">„{current ? current.question : question.trim()}”</p>
|
|
||||||
)}
|
|
||||||
<p className="hint" role="status">
|
<p className="hint" role="status">
|
||||||
{phase === "picking" &&
|
{phase === "picking" &&
|
||||||
`Hangolódj a kérdésedre, és válassz ösztönösen. ${picked.length}/${chosen.cards}`}
|
`Hangolódj a kérdésedre, és válassz ösztönösen. ${picked.length}/${chosen.cards}`}
|
||||||
@@ -269,11 +265,9 @@ export function TarotTable({
|
|||||||
<>
|
<>
|
||||||
<TarotLive key={current.id} initial={current} isAdmin={isAdmin} onChange={finished} />
|
<TarotLive key={current.id} initial={current} isAdmin={isAdmin} onChange={finished} />
|
||||||
<div className="form-actions">
|
<div className="form-actions">
|
||||||
{!writing && (
|
<button type="button" className="btn" onClick={again}>
|
||||||
<button type="button" className="btn" onClick={again}>
|
Új jóslás
|
||||||
Új jóslás
|
</button>
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
<Link href={`/kartyajoslas/${current.id}`} className="btn btn-ghost">
|
<Link href={`/kartyajoslas/${current.id}`} className="btn btn-ghost">
|
||||||
Külön oldalon
|
Külön oldalon
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
Reference in New Issue
Block a user