lib updates, img sizing fixes

This commit is contained in:
N0rdye 2023-07-01 16:47:05 +05:00
parent 2bc7d45097
commit a5ef0206c4
9 changed files with 11813 additions and 56 deletions

View File

@ -17,14 +17,14 @@ services:
dockerfile: Dockerfile
restart: always
ports:
- 80:8080
- 8080:8080
volumes:
- ./:/usr/src/app
# phpmyadmin:
# image: phpmyadmin
# restart: always
# ports:
# - 2000:80
# environment:
# - PMA_ARBITRARY=1
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- 2000:80
environment:
- PMA_ARBITRARY=1

View File

@ -20,9 +20,11 @@ const app = express();
// const { mainModule } = require('process');
// const { name } = require('ejs');
const maxRequestBodySize = '10mb';
app.set('view engine', 'ejs');
app.use(express.urlencoded({
extended: false
extended: false,
limit: maxRequestBodySize
}));
app.use(express.static('public'));
app.use(cookieParser());
@ -43,7 +45,7 @@ app.post('/back_login', (req, res) => {
db.gv("users","login",`'${ilogin}'`,(udata)=>{udata = udata[0];
if(ipass == udata["pass"]){
console.log(udata["uuid"]+" logged in by login & pass from "+cook["sid"]);
res.cookie("uuid",udata["uuid"],{maxAge:week,path:"/;SameSite=None"});
res.cookie("uuid",udata["uuid"],{maxAge:week,path:"/;SameSite=Strict"});
// db.sv("users","sids",sids += inp["sid"]+";","uuid",udata["uuid"],()=>{});
db.nr("sids",'`sid`,`uid`',`'${cook["sid"]}','${udata["id"]}'`);
@ -153,7 +155,7 @@ app.post("/sid_log",(req,res) =>{
app.post("/get_sid" , (req,res) =>{
let inp = req.body;
let sid = func.get_uuid(inp["name"]);
res.cookie("sid",sid,{maxAge:(week),path:"/;SameSite=None"});
res.cookie("sid",sid,{maxAge:(week),path:"/;SameSite=Strict"});
res.send({out:"good"});
});

View File

@ -11,7 +11,6 @@ function get_count(clas){
function create(clas,x,y,body,id){
let main_clas = clas.split(" ")[0];
// if (body == null || body == "") body = "[]";
try{
load_obj(main_clas,(db_data)=>{
// let data = db_data;
// body = data["img"];
@ -45,7 +44,6 @@ function create(clas,x,y,body,id){
// let obj_doc = document.getElementById(obj);
// console.log(obj_doc.classList);
})
}catch{}
}
function wall_size_change(type,value){
@ -233,7 +231,7 @@ interact('.createzone').dropzone({
zone.classList.remove('drop-target');
drag.classList.remove('spawn');
let x = zone.getBoundingClientRect().left + window.scrollX - 15;
let y = zone.getBoundingClientRect().top + window.scrollY - 30;
let y = zone.getBoundingClientRect().top + window.scrollY - 32;
create(`${zone.classList[0]} drag spawn`,x,y,`${zone.classList[0]}`,`none`);
},
ondrop: function (event) {var drag = event.relatedTargetdrag.classList.remove('in_zone');drag.classList.remove('can-drop');},
@ -244,7 +242,7 @@ function drag_start() {
let zones = document.getElementsByClassName("createzone");
Object.entries(zones).forEach(([key, zone]) => {
let x = zone.getBoundingClientRect().left - scrollX - 15;
let y = zone.getBoundingClientRect().top - scrollY - 30;
let y = zone.getBoundingClientRect().top - scrollY - 32;
// console.log(x,y);
create(`${zone.classList[0]} drag spawn`,x,y,`${zone.classList[0]}`,`none`);
});

11758
public/lib/interact.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,8 @@
<h1>hello admin</h1>
<div class="nobj">
<div class="img_preview">
<input type="file" onchange="previewFile()" accept="image/*" value="" maxlength="1"><br>
<label for="img_file">max size 1mb</label><br>
<input type="file" id="img_file" onchange="previewFile()" accept="image/*" value="" maxlength="1"><br>
<img src="" height="100" alt="Image preview...">
</div>
<textarea name="" id="nobj_description" cols="30" rows="5" placeholder="object description"></textarea>

View File

@ -100,7 +100,7 @@
<%- include('./static/start.ejs',{name:proj_name,async: true}) %>
<%- include('./header.ejs') %>
<script src="/lib/interact.min.js"></script>
<script src="/lib/interact.js"></script>
<script src="/lib/html2canvas.js"></script>
@ -124,14 +124,14 @@
<label for="wall_height">height </label>
<div id="wall_height_value">0</div>
</div>
<input type="range" step="0.1" min="0" max="4.9" id="wall_height" value="2" oninput="wall_size_change('height')">
<input type="range" step="0.1" min="0" max="4.9" id="wall_height" value="1.9" oninput="wall_size_change('height')">
</div>
<div>
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_width">width</label>
<div id="wall_width_value">0</div>
</div>
<input type="range" step="0.1" min="0" max="6.9" id="wall_width" value="4" oninput="wall_size_change('width')">
<input type="range" step="0.1" min="0" max="6.9" id="wall_width" value="3.9" oninput="wall_size_change('width')">
</div>
</div>
<div class="czones">
@ -177,7 +177,7 @@
data.forEach(value => {
// console.log(value);
let czones = document.getElementsByClassName("czones")[0];
let czone = document.createElement('img');
let czone = document.createElement('div');
czone.classList.add(value["name"]);
czone.classList.add("createzone");
czones.append(czone)