ad symbols, use newest scad version

master
Dirk Heilig 2024-07-12 12:10:26 +02:00
parent 02291a9527
commit aa6eb6d457
5 changed files with 47 additions and 9 deletions

View File

@ -1,15 +1,16 @@
FROM debian:12
RUN true
RUN apt-get update && apt-get upgrade -y && apt-get clean
RUN apt-get install -y supervisor apache2 php libapache2-mod-php php-mbstring php-zip curl git openscad zip cmake build-essential php-opcache
RUN apt-get install -y supervisor apache2 php libapache2-mod-php php-mbstring php-zip curl git openscad zip cmake build-essential php-opcache wget
RUN apt-get clean
RUN chown -R www-data:www-data /var/www
RUN curl https://files.openscad.org/snapshots/OpenSCAD-2024.03.28.ai18952-x86_64.AppImage > /tmp/openscad
RUN chmod +x /tmp/openscad
ADD htmlq /usr/local/bin/
ADD openscad_installer /tmp/
RUN /tmp/openscad_installer
WORKDIR /opt
RUN /tmp/openscad --appimage-extract
RUN ln -s /opt/squashfs-root/usr/bin/openscad /usr/local/bin/openscad
RUN git clone https://github.com/jschobben/colorscad
WORKDIR /opt/colorscad/3mfmerge/build
RUN pwd; ls;ls ..
RUN cmake .. -DLIB3MF_TESTS=OFF
RUN cmake --build .
WORKDIR /opt/colorscad/test

BIN
htmlq 100755

Binary file not shown.

19
openscad_installer 100755
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
function getFileName() {
curl -s https://files.openscad.org/snapshots/ | htmlq 'a[href$="x86_64.AppImage"]' -a href | tail -n1
}
function getDownloadUrl() {
echo "https://files.openscad.org/snapshots/$(getFileName)"
}
wget -q -O /tmp/openscad "$(getDownloadUrl)"
chmod +x /tmp/openscad
chmod +x /tmp/openscad
cd /opt
/tmp/openscad --appimage-extract
ln -s /opt/squashfs-root/usr/bin/openscad /usr/local/bin/openscad

View File

@ -1,11 +1,24 @@
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$useSymbols=isset($_POST["use_symbols"]) && $_POST["use_symbols"] == "1";
$tags = explode("\n", $_POST["tags"]);
$tags = array_map("trim", $tags);
$tags = array_filter($tags, function ($tag) {
return !empty($tag);
});
$tags=array_map(function($tag) use ($useSymbols){
$tag=trim($tag);
$tag=["text"=>$tag,"symbolPre"=>"","symbolPost"=>""];
if($useSymbols){
$tag['symbolPre']=substr($tag['text'],0,1);
$tag['symbolPost']=substr($tag['text'],-1);
$tag['text']=substr($tag['text'],1,-1);
}
return $tag;
},$tags);
if (empty($tags)) {
header("Location: /?err=notags");
exit();
@ -98,8 +111,11 @@ switch ($_GET["err"]) {
<h1>c3RE AuerBoxTag Generator</h1>
<div style="color:red"><?php echo $err; ?></div>
<form method="post" action="/">
<textarea name="tags" rows="10" cols="30" placeholder="one tag per line please"></textarea>
<label title="Render the first and last Char in Symbola if its not alphanumeric"><input type="checkbox" name="use_symbols" value="1"> Use Symbols
&#x24D8;
</label>
<br>
<textarea name="tags" rows="10" cols="30" placeholder="one tag per line please" data-placeholder-nosym="one tag per line please" data-placeholder-sym="♡|||Anna|||♥"></textarea>
<br>
<br>
<input type="submit" value="Lets Go!">

View File

@ -23,7 +23,9 @@ $jobId = basename($jobFile, ".json");
$tags = json_decode(file_get_contents($jobFile), true);
$zipFile = $dlDir . $jobId . ".zip";
chdir(__DIR__ . "/../AuerNameTag");
$shellArgs = array_map("escapeshellarg", $tags);
$shellArgs = array_map(function($tag){
return escapeshellarg($tag['name'].' '.$tag['symbolPrefix'].' '.$tag['symbolPost']);
}, $tags);
system("rm -rf out");
system("git reset --hard");
system("./make.sh " . implode(" ", $shellArgs));