Updated auto save, Updated install, Updated auto kick

This commit is contained in:
xevidos 2018-07-26 15:39:40 -04:00
parent 602d90b120
commit f0f9f3a89e
14 changed files with 211 additions and 47 deletions

View File

@ -1,29 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Read Me</title>
</head>
<body>
<h1>Codaid</h1>
<p>
This is the Telaaedifex team's custom version of Codiad. Codiad is a web-based IDE framework with a small footprint and minimal requirements.<br>
<br>
Codiad was built with simplicity in mind, allowing for fast, interactive development without the massive overhead of some of the larger desktop editors. That being said even users of IDE's such as Eclipse, NetBeans and Aptana are finding Codiad's simplicity to be a huge benefit. While simplicity was key, we didn't skimp on features and have a team of dedicated developers actively adding more.<br>
<br>
For more information on the project please check out the check out the Wiki.<br>
<br>
Distributed under the MIT-Style License. See LICENSE.txt file for more information.<br>
<br>
When you see a - in front of a task that means it is a possibility but we aren't sure we will add it yet.<br>
<br>
Task List:<br>
<ul>
<li>Add ability to hide cursors when in collaboration mode.</li>
<li>Add ability to rename site.</li>
<li>- Add ability to see what people are highlighting in collaboration mode.</li>
<li>Add mobile compatibility.</li>
<li>Clean up update script.</li>
</ul>
</p>
</body>
</html>

38
README.md Executable file
View File

@ -0,0 +1,38 @@
Codaid
This is the Telaaedifex team's custom version of Codiad. Codiad is a web-based IDE framework with a small footprint and minimal requirements.
Codiad was built with simplicity in mind, allowing for fast, interactive development without the massive overhead of some of the larger desktop editors. That being said even users of IDE's such as Eclipse, NetBeans and Aptana are finding Codiad's simplicity to be a huge benefit. While simplicity was key, we didn't skimp on features and have a team of dedicated developers actively adding more.
For more information on the project please check out the check out the Wiki.
Distributed under the MIT-Style License. See LICENSE.txt file for more information.
Features:
* 132 Native programming languages supported.
* Auto Complete ( CTRL + Space )
* Auto Save
* Collaborative Editing
* Multi Cursor
* PHP 7.2 Compatibility
* Self updating
* Split editor mode
* Themes
When you see a - in front of a task that means it is a possibility but we aren't sure we will add it yet.
Task List:
* Add ability to center bottom of code.
* Add ability to hide cursors when in collaboration mode.
* Add ability to login with LDAP.
* Add ability to rename site.
* Add ability to save users in database.
* -Add ability to see what people are highlighting in collaboration mode.
* Add mobile compatibility.
* Clean up Collaborative compatibility
* Clean up update script.
* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit)

View File

@ -4,7 +4,10 @@
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Common::startSession();
//////////////////////////////////////////////////////////////////

View File

@ -23,7 +23,7 @@
// Show a popup with word completion suggestions.
//
//////////////////////////////////////////////////////////////////
codiad.autocomplete = {
wordRegex: /[^a-zA-Z_0-9\$]+/,
@ -75,7 +75,12 @@
this.show();
// handle click-out autoclosing.
var fn = function () {
var fn = function ( event ) {
let keycodes = [ 9, 10, 13 ]
/*if( ! keycodes.includes( event.keyCode ) ) {
return;
}*/
_this.hide();
$(window).off('click', fn);
};
@ -236,14 +241,26 @@
},
onDocumentChange: function (e) {
if (e.data.text.search(/^\s+$/) !== -1) {
if ( e.data === undefined || e.data === null || e.data.text.search(/^\s+$/) !== -1) {
this.hide();
return;
}
var position = null;
if (e.data.action === 'insertText') {
position = e.data.range.end;
if( codiad.autosave.saving === false ) {
position = e.data.range.end;
} else {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > 50){
break;
}
}
position = e.data.range.end;
}
} else if (e.data.action === 'removeText') {
position = e.data.range.start;
} else {
@ -676,4 +693,4 @@
};
})(this, jQuery);
})(this, jQuery);

112
components/autosave/init.js Executable file
View File

@ -0,0 +1,112 @@
/*
* Copyright (c) Codiad, Kent Safranski (codiad.com), and Isaac Brown (telaaedifex.com), distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
(function(global, $){
// Define core
var codiad = global.codiad,
scripts= document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
// Instantiates plugin
$(function() {
amplify.subscribe('settings.changed', function(){
//React here on changed settings
location.reload();
});
codiad.auto_save.init();
});
codiad.auto_save = {
// Allows relative `this.path` linkage
path: curpath,
saving: false,
settings: {
autosave: true,
toggle: true,
},
init: function() {
this.get_settings();
// Check if the auto save setting is true or false
if( this.settings.autosave === false || this.settings.autosave === "false" ) {
return;
}
$(window).focus(function() {
//Turn auto save off if the user leaves the tab.
codiad.auto_save.settings.toggle = false;
console.log( 'Auto save resumed' );
});
$(window).blur(function() {
//Turn auto save off if the user leaves the tab.
codiad.auto_save.settings.toggle = false;
console.log( 'Auto save paused' );
});
//let editor = document.getElementsByClassName( 'ace_content' )[0];
let auto_save_trigger = setInterval( this.auto_save, 256 );
},
/**
*
* This is where the core functionality goes, any call, references,
* script-loads, etc...
*
*/
auto_save: function() {
if( this.settings.toggle === false ) {
return;
}
this.saving = true;
if ( codiad.active.getPath() === null ) {
this.saving = false;
return;
}
let tabs = document.getElementsByClassName( "tab-item" );
let path = codiad.active.getPath();
let content = codiad.editor.getContent();
codiad.active.save;
codiad.filemanager.saveFile(path, content, localStorage.removeItem(path), false);
var session = codiad.active.sessions[path];
if(typeof session != 'undefined') {
session.untainted = content;
session.serverMTime = session.serverMTime;
if (session.listThumb) session.listThumb.removeClass('changed');
if (session.tabThumb) session.tabThumb.removeClass('changed');
}
this.saving = false;
},
get_settings: function() {
var _this = this;
$.each(['autosave'], function(idx, key) {
var localValue = localStorage.getItem('codiad.settings.' + key);
if (localValue !== null) {
_this.settings[key] = localValue;
}
});
}
};
})(this, jQuery);

View File

@ -120,7 +120,7 @@ if (!file_exists($users) && !file_exists($projects) && !file_exists($active)) {
if ( ! is_dir( $sessions ) ) {
mkdir( $sessions, 755 );
mkdir( $sessions, 0755 );
}
//////////////////////////////////////////////////////////////////
@ -145,7 +145,7 @@ if (!file_exists($users) && !file_exists($projects) && !file_exists($active)) {
$config_data = '<?php
/*
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
* Copyright (c) Codiad & Kent Safranski (codiad.com), Isaac Brown (telaaedifex.com), distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/

View File

@ -45,7 +45,8 @@
var sync_system = (localStorage.getItem('codiad.settings.system.sync') == "true");
var sync_plugin = (localStorage.getItem('codiad.settings.plugin.sync') == "true");
var auto_save = (localStorage.getItem('codiad.settings.autosave') == "true");
if (sync_system || sync_plugin) {
for (var i = 0; i < localStorage.length; i++) {
key = localStorage.key(i);
@ -55,12 +56,15 @@
if (pluginRegex.test(key) && sync_plugin) {
settings[key] = localStorage.getItem(key);
}
if (pluginRegex.test(key) && auto_save) {
settings[key] = localStorage.getItem(key);
}
}
}
settings['codiad.settings.system.sync'] = sync_system;
settings['codiad.settings.plugin.sync'] = sync_plugin;
$.post(this.controller + '?action=save', {settings: JSON.stringify(settings)}, function(data){
parsed = codiad.jsend.parse(data);
});

View File

@ -5,6 +5,19 @@
<hr>
<label></label>
<table class="settings">
<tr>
<td><?php i18n("Auto Save"); ?></td>
<td>
<select class="setting" data-setting="codiad.settings.autosave">
<option value="true"><?php i18n("True") ?></option>
<option value="false" default><?php i18n("False") ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Right Sidebar Trigger"); ?></td>

View File

@ -12,7 +12,7 @@ class Update {
// CONSTANTS
//////////////////////////////////////////////////////////////////
CONST VERSION = "v.2.9.1";
CONST VERSION = "v.2.9.0";
//////////////////////////////////////////////////////////////////
// PROPERTIES

View File

@ -58,9 +58,9 @@ switch($_GET['action']){
?>
<br><br><b><label>
<?php echo htmlentities("Error, could not check for updates. Please try again later ..."); ?><br>
<?php echo htmlentities("If this problem persists, then please contact the web administrator."); ?>
</label></b>
<?php echo htmlentities("Error, could not check for updates. Please try again later ..."); ?><br>
<?php echo htmlentities("If this problem persists, then please contact the web administrator."); ?>
</label></b>
<?php
} else {
?>

View File

@ -285,4 +285,4 @@ class User
{
return preg_replace('#[^A-Za-z0-9'.preg_quote('-_@. ').']#', '', $username);
}
}
}

View File

@ -5,7 +5,7 @@
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
require_once('../../common.php');
//////////////////////////////////////////////////////////////////

View File

@ -10,6 +10,12 @@
parse: function(d) { // (Data)
var obj = $.parseJSON(d);
if( obj !== undefined && obj !== null ) {
return;
}
if (obj.debug !== undefined && Array.isArray(obj.debug)) {
var debug = obj.debug.join('\nDEBUG: ');
if(debug !== '') {

View File

@ -94,7 +94,7 @@
// Run resize command to fix render issues
// Add a check to see if it is not undefined due to an
// error being generated on the login page.
if ( typeof( codiad.editor.resize() ) !== "undefined" ) {
if ( codiad.editor !== undefined && codiad.editor !== null ) {
codiad.editor.resize();
codiad.active.updateTabDropdownVisibility();