SC CODE: // Copyright 2024. Civilware. All rights reserved.
// TELA Decentralized Web Document (TELA-DOC-1)
Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "index.html")
31 STORE("descrHdr", "Index")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "index.html")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "1b7d3ee21ba8e627053f5314e79024bab4a2c9eddf3154c28c073e66ab463afe")
37 STORE("fileCheckS", "2c3d881a1131931c67432ed5241adabf03d81cbc693abdc541f70cd01588c21d")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>Tela-Site Installer</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<div class="connect">
<button class="connect-button" id="connectButton">Connect Dero</button> <span id="wallet_address"></span>
</div>
<style>body{background:#2196F3;}body>*{margin:auto;max-width:1400px;}main{background:#fcfcfc;box-shadow:0px 2px 6px 2px #ffffff;padding:10px;}main input,main textarea,main button,main select{margin:5px 0 10px}@media only screen and (min-width: 600px){.inputs{display:flex}.inputs>div,button#deployDoc{margin:5px}.inputs_fields{display:flex;flex-direction:column;max-width:50%}}.inputs_fields label{display:flex;flex-direction:column}.inputs_fields textarea{max-width:100%}.inputs>div.preview{display:flex;flex-grow:1;flex-direction:column}.inputs textarea{display:flex;flex-grow:1}</style>
<main>
<h1>Tela-Site Installer</h1>
<p>This installer only installs Tela Sites, editing will have to be done somewhere else if desired. For more info, visit: <a href="https://github.com/civilware/tela/blob/main/TELA-DOC-1/README.md" target="_blank">Tela-Docs</a> and <a href="https://github.com/civilware/tela/blob/main/TELA-INDEX-1/README.md" target="_blank">Tela-Indexes</a>.</p>
<h2>Step 1 - Install Docs</h2>
<p>Create a list of Tela-Docs to install by filling out the required fields then uploading content files and signing them. After installing your docs list, those will be used for the Index-Installation which is done last. <i>IMPORTANT NOTE! Make sure not to leave this page until you have completed installing unless you know what you are doing of course lol</i> </p>
<div class="inputs">
<div class="inputs_fields">
<div>Select Tela-doc type template for install</div>
<select id="doc_type">
<option>Choose Doc Type</option>
<option value="TELA-HTML-1">html</option>
<option value="TELA-JS-1">js</option>
<option value="TELA-CSS-1">css</option>
</select><br>
<label>Name*<br><input id="docNameHdr" type="text" placeholder="nameHdr" disabled="disabled"></label><br>
<label>Description*<br><textarea id="docDescrHdr" placeholder="descrHdr"></textarea></label><br>
<label>Icon<br><input id="docIconURLHdr" type="text" placeholder="iconURLHdr"></label><br>
<label>D-URL*<br><input id="docDURL" type="text" placeholder="*dURL"></label><br>
<label>Subdirectory<br><input id="docSubDir" type="text" placeholder="subDir"></label><br>
<label>Document / file content only - Max 18kb (Automatically added inside multi-line comment "/**/")<br>
<input id="open_file" type="file"></label><br>
<label>Selected Tela-Doc contents<br>
<textarea id="document"></textarea><br></label>
</div>
<div class="preview">
Doc SC Preview<br>
<textarea id="smartcontract"></textarea><br>
</div>
</div>
<button id="addDoc" disabled="disabled">Add Doc</button>
<hr>
<div>Docs to Install:</div>
<div id="install_output">No Tela-Docs to be installed yet.</div>
<hr>
<button id="deployDocs" disabled="disabled">Deploy All Docs</button>
<div>List of installed docs:</div>
<div id="installed_output">No Tela-Docs installed yet.</div>
<h2>Step 2 - Install Index</h2>
<p>After installing all documents, fill in the template to generate a Tela-Index smart contract. Make sure to copy install or save it somewhere before leaving this page so it won't be lost.</p>
<div class="inputs">
<div class="inputs_fields">
<label>Name*<br><input id="indexNameHdr" type="text" placeholder="nameHdr"></label><br>
<label>Description*<br><textarea id="indexDescrHdr" placeholder="descrHdr"></textarea></label><br>
<label>Icon<br><input id="indexIconURLHdr" type="text" placeholder="iconURLHdr"></label><br>
<label>D-URL*<br><input id="indexDURL" type="text" placeholder="*dURL"></label><br>
</div>
<div class="preview">
<textarea id="indexSCCode"></textarea><br>
</div>
</div>
<button id="deployIndex">Deploy Index</button><br>
<div>If the Icon (iconURLHdr) doesn't apply you can leave that blank, it will show up in the wallet along with the name, description and durl if it is a valid image link.</div><br>
<div id="indexscid">Tela-Index not installed yet.</div>
<br><br>
<p>Visit <a href="tela://open/f32e74164be49cf1d0af1daca897a9d79f0de1b4c48c68b9d462c9724ab138fb">WebGuy Alpha</a> for more Dero tools</p>
</main>
<script src="js/xswd.js"></script>
<script src="js/scripts.js"></script>
<script src="js/contracts.js"></script>
</body>
</html> */ |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'// Copyright 2024. Civilware. All rights reserved.
// TELA Decentralized Web Document (TELA-DOC-1)
Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "index.html")
31 STORE("descrHdr", "Index")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "index.html")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "1b7d3ee21ba8e627053f5314e79024bab4a2c9eddf3154c28c073e66ab463afe")
37 STORE("fileCheckS", "2c3d881a1131931c67432ed5241adabf03d81cbc693abdc541f70cd01588c21d")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>Tela-Site Installer</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<div class="connect">
<button class="connect-button" id="connectButton">Connect Dero</button> <span id="wallet_address"></span>
</div>
<style>body{background:#2196F3;}body>*{margin:auto;max-width:1400px;}main{background:#fcfcfc;box-shadow:0px 2px 6px 2px #ffffff;padding:10px;}main input,main textarea,main button,main select{margin:5px 0 10px}@media only screen and (min-width: 600px){.inputs{display:flex}.inputs>div,button#deployDoc{margin:5px}.inputs_fields{display:flex;flex-direction:column;max-width:50%}}.inputs_fields label{display:flex;flex-direction:column}.inputs_fields textarea{max-width:100%}.inputs>div.preview{display:flex;flex-grow:1;flex-direction:column}.inputs textarea{display:flex;flex-grow:1}</style>
<main>
<h1>Tela-Site Installer</h1>
<p>This installer only installs Tela Sites, editing will have to be done somewhere else if desired. For more info, visit: <a href="https://github.com/civilware/tela/blob/main/TELA-DOC-1/README.md" target="_blank">Tela-Docs</a> and <a href="https://github.com/civilware/tela/blob/main/TELA-INDEX-1/README.md" target="_blank">Tela-Indexes</a>.</p>
<h2>Step 1 - Install Docs</h2>
<p>Create a list of Tela-Docs to install by filling out the required fields then uploading content files and signing them. After installing your docs list, those will be used for the Index-Installation which is done last. <i>IMPORTANT NOTE! Make sure not to leave this page until you have completed installing unless you know what you are doing of course lol</i> </p>
<div class="inputs">
<div class="inputs_fields">
<div>Select Tela-doc type template for install</div>
<select id="doc_type">
<option>Choose Doc Type</option>
<option value="TELA-HTML-1">html</option>
<option value="TELA-JS-1">js</option>
<option value="TELA-CSS-1">css</option>
</select><br>
<label>Name*<br><input id="docNameHdr" type="text" placeholder="nameHdr" disabled="disabled"></label><br>
<label>Description*<br><textarea id="docDescrHdr" placeholder="descrHdr"></textarea></label><br>
<label>Icon<br><input id="docIconURLHdr" type="text" placeholder="iconURLHdr"></label><br>
<label>D-URL*<br><input id="docDURL" type="text" placeholder="*dURL"></label><br>
<label>Subdirectory<br><input id="docSubDir" type="text" placeholder="subDir"></label><br>
<label>Document / file content only - Max 18kb (Automatically added inside multi-line comment "/**/")<br>
<input id="open_file" type="file"></label><br>
<label>Selected Tela-Doc contents<br>
<textarea id="document"></textarea><br></label>
</div>
<div class="preview">
Doc SC Preview<br>
<textarea id="smartcontract"></textarea><br>
</div>
</div>
<button id="addDoc" disabled="disabled">Add Doc</button>
<hr>
<div>Docs to Install:</div>
<div id="install_output">No Tela-Docs to be installed yet.</div>
<hr>
<button id="deployDocs" disabled="disabled">Deploy All Docs</button>
<div>List of installed docs:</div>
<div id="installed_output">No Tela-Docs installed yet.</div>
<h2>Step 2 - Install Index</h2>
<p>After installing all documents, fill in the template to generate a Tela-Index smart contract. Make sure to copy install or save it somewhere before leaving this page so it won't be lost.</p>
<div class="inputs">
<div class="inputs_fields">
<label>Name*<br><input id="indexNameHdr" type="text" placeholder="nameHdr"></label><br>
<label>Description*<br><textarea id="indexDescrHdr" placeholder="descrHdr"></textarea></label><br>
<label>Icon<br><input id="indexIconURLHdr" type="text" placeholder="iconURLHdr"></label><br>
<label>D-URL*<br><input id="indexDURL" type="text" placeholder="*dURL"></label><br>
</div>
<div class="preview">
<textarea id="indexSCCode"></textarea><br>
</div>
</div>
<button id="deployIndex">Deploy Index</button><br>
<div>If the Icon (iconURLHdr) doesn't apply you can leave that blank, it will show up in the wallet along with the name, description and durl if it is a valid image link.</div><br>
<div id="indexscid">Tela-Index not installed yet.</div>
<br><br>
<p>Visit <a href="tela://open/f32e74164be49cf1d0af1daca897a9d79f0de1b4c48c68b9d462c9724ab138fb">WebGuy Alpha</a> for more Dero tools</p>
</main>
<script src="js/xswd.js"></script>
<script src="js/scripts.js"></script>
<script src="js/contracts.js"></script>
</body>
</html> */'] |