Explorar el Código

Feature: 字体文件下载脚本生产

wudi hace 5 años
padre
commit
f87858e12d
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12 0
      get_fonts.js

+ 12 - 0
get_fonts.js

@@ -0,0 +1,12 @@
+const fs = require('fs')
+const re = /,([^,]+(ttf|ttc|otf))"/g
+
+const cmd = fs.openSync('dl-fonts.sh', 'w')
+fs.readFile('./public/code/DBS.js', { encoding: 'utf-8' }, (err, data) => {
+    if (!err) {
+        Array.from((new Set(Array.from(data.matchAll(re)).map(match => match[1]))).values()).forEach(link => {
+            fs.writeSync(cmd, `curl -o "public/rsrc/fonts/${link}" --create-dirs "https://www.photopea.com/rsrc/fonts/${link}"\n`)
+        })
+        fs.closeSync(cmd)
+    }
+})