Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d9ea74a
Update full.html
benhatsor Apr 28, 2022
e4a791a
Update full.html
benhatsor Apr 29, 2022
4542da0
Create gitlab-auth.js
benhatsor Apr 29, 2022
e53f43d
Update gitlab-auth.js
benhatsor Apr 29, 2022
f41faa8
Update gitauth.js
benhatsor Apr 29, 2022
8046fc1
Update codedrop.js
benhatsor Apr 29, 2022
2955c3d
Update filebrowser.js
benhatsor Apr 29, 2022
33a6d37
Update codeit.js
benhatsor Apr 29, 2022
44c7945
Update gitauth.js
benhatsor Apr 29, 2022
f474938
Update gitlab-auth.js
benhatsor Apr 29, 2022
846bb55
Update gitauth.js
benhatsor Apr 29, 2022
e8a699f
Update gitlab-auth.js
benhatsor Apr 29, 2022
a2338f6
Create gitlab-api.js
benhatsor Apr 29, 2022
7ae163d
Update gitlab-auth.js
benhatsor Apr 29, 2022
12d6451
Update utils.js
benhatsor Apr 29, 2022
74abb04
Update gitlab-api.js
benhatsor Apr 29, 2022
e3db866
Update gitlab-api.js
benhatsor Apr 29, 2022
65ef016
Update gitlab-api.js
benhatsor Apr 29, 2022
49d1904
Update service-worker.js
benhatsor Apr 30, 2022
adc3b89
Update index.html
benhatsor Apr 30, 2022
ad06e86
Update privacy.html
benhatsor Apr 30, 2022
87c191b
Update index.html
benhatsor Apr 30, 2022
0de43eb
Update full.html
benhatsor Apr 30, 2022
7ff2d69
Update homepage.js
benhatsor May 1, 2022
4481d7d
Update full.html
benhatsor May 2, 2022
9c67e08
Update index.html
benhatsor May 2, 2022
517f391
Update full.html
benhatsor May 2, 2022
bfa8f31
Update gitauth.js
benhatsor May 2, 2022
efb619b
Update full.html
benhatsor May 2, 2022
8e38033
Update splash files
benhatsor May 2, 2022
353cf17
Update index.html
benhatsor May 2, 2022
144e4bc
Update vercel.json
benhatsor May 2, 2022
7ca29a4
Update vercel.json
benhatsor May 2, 2022
6de6109
Update index.html
benhatsor May 2, 2022
648f7e9
d
benhatsor May 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codedrop.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

function getFileLang(src) {

var lang_aliases = /*aliases_placeholder[*/ {
Expand Down
3 changes: 0 additions & 3 deletions filebrowser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/*
github
*/

// show bookmark on hover
sidebarToggle.addEventListener('mouseover', () => {
Expand Down
32 changes: 17 additions & 15 deletions full.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
<meta name="apple-mobile-web-app-title" content="Codeit">

<meta charset="utf-8">
<meta name="description" content="Codeit runs on the web, open source, and free. Supports HTML, CSS, JavaScript, Python, Bootstrap, XML and more. Easy to use without how to.">

<meta name="description" content="Run JavaScript projects, code your ideas, and share it all with friends, family, and the world on Codeit.">
<meta property="og:title" content="Codeit | Mobile code editor connected to Git">
<meta property="og:description" content="Codeit runs on the web, open source, and free. Supports HTML, CSS, JavaScript, Python, Bootstrap, XML and more. Easy to use without how to.">
<meta property="og:description" content="Run JavaScript projects, code your ideas, and share it all on Codeit.">
<meta property="og:url" content="https://codeit.codes">
<meta property="og:image" content="https://codeit.codes/images/banner-og.png">
<meta property="og:type" content="application">
<meta property="og:site_name" content="Codeit Code Editor">

<meta property="og:type" content="website">
<meta property="og:site_name" content="Codeit">
<meta property="twitter:title" content="Codeit | Mobile code editor connected to Git">
<meta property="twitter:account_id" content="1484271514543345665">
<meta property="twitter:site" content="@codeitcodes">
<meta property="twitter:site:id" content="@codeitcodes">
<meta property="twitter:creator" content="@codeitcodes">
<meta property="twitter:creator:id" content="@codeitcodes">
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="codeit.codes">
<meta property="twitter:url" content="https://codeit.codes">
<meta name="twitter:description" content="Codeit runs on the web, open source, and free. Supports HTML, CSS, JavaScript, Python, Bootstrap, XML and more. Easy to use without how to.">
<meta property="twitter:url" content="https://codeit.codes/">
<meta name="twitter:description" content="Run JavaScript projects, code your ideas, and share it all on Codeit.">
<meta name="twitter:image" content="https://codeit.codes/images/banner-og.png">

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="referrer" content="origin-when-cross-origin">

<meta name="referrer" content="default">
<meta name="keywords" content="code editor, version control tools, source code versioning, source code management tools, python, jquery demo, html, git, how to, bootstrap, jquery, javascript, javascript tutorial, javascript tutorial for beginners, javascript programming, html web form, create form in html, responsive web design, html web design, html design, responsive website development, html5 tutorial, html5 css3, html5 development, web design software, web development software, git tutorial, git howto, git repository, git command, git source code, top programming languages to learn, best programming language, best computer language, open source, open source code, open source applications, source code editor, software development tools, development tool, software developer tools list, programmer tool, web application development software">
<link rel="canonical" href="https://codeit.codes/">
<meta name="next-head-count" content="24">
Expand All @@ -40,15 +42,15 @@

<link rel="shortcut icon" href="/icons/android-app-512.png">
<link rel="apple-touch-icon" href="/icons/iphone-app-180.png">

<link rel="apple-touch-startup-image" href="https://codeit.codes/splashes/apple-splash-2048-2732.jpg" media="(orientation: portrait) and (orientation: landscape)">

<link rel="stylesheet" href="/full.css">

<link rel="apple-touch-startup-image" href="https://codeit.codes/splashes/apple-splash-2048-2732.jpg" media="(orientation: portrait) and (orientation: landscape)">

<link rel="preconnect" href="https://codeit.codes">
<link rel="preconnect" href="https://api.github.com" crossorigin>

<link href="/fonts/fonts.css" rel="stylesheet">
<link rel="stylesheet" href="/fonts/fonts.css">

</head>
<body ontouchstart="">
Expand Down
44 changes: 19 additions & 25 deletions git/gitauth.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
github
*/

// git login
// github login

window.onload = async () => {

Expand Down Expand Up @@ -62,15 +59,17 @@ window.onload = async () => {
}


const authURL = 'https://github.com/login/oauth/authorize?client_id=7ede3eed3185e59c042d&scope=repo,user,write:org';

loginButton.addEventListener('click', () => {

if (isMobile) {

window.location.href = 'https://github.com/login/oauth/authorize?client_id=7ede3eed3185e59c042d&scope=repo,user,write:org';
window.location.href = authURL;

} else {

window.open('https://github.com/login/oauth/authorize?client_id=7ede3eed3185e59c042d&scope=repo,user,write:org', 'Login with Github', 'height=575,width=575');
window.open(authURL, 'Login with Github', 'height=575,width=575');

}

Expand All @@ -79,35 +78,30 @@ window.onload = async () => {

window.addEventListener('message', (event) => {

// if redirected from git auth
if (event.source.location.pathname === '/git/login') {

// hide intro screen
sidebar.classList.remove('intro');
// hide intro screen
sidebar.classList.remove('intro');

// if on safari, refresh header color
if (isSafari) {
// if on safari, refresh header color
if (isSafari) {

document.querySelector('meta[name="theme-color"]').content = '#313744';
document.querySelector('meta[name="theme-color"]').content = '#313744';

onNextFrame(() => {
onNextFrame(() => {

document.querySelector('meta[name="theme-color"]').content = '#1a1c24';
document.querySelector('meta[name="theme-color"]').content = '#1a1c24';

});
});

}
}

// start loading
startLoading();
// start loading
startLoading();

const gitCode = event.data;
const gitCode = event.data;

// get git token from Github
getGithubToken(gitCode);
// get git token from Github
getGithubToken(gitCode);

}

})


Expand Down
4 changes: 4 additions & 0 deletions git/gitlab/gitlab-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://gitlab.com/api/v4/projects?access_token=19a48ef34811b9425b6fc1e4c75f1358bdf7f528d151ec5624c46fa61e8b4c03&order_by=updated_at&min_access_level=30
https://docs.gitlab.com/ee/api/oauth2.html
https://docs.gitlab.com/ee/api/projects.html
https://docs.gitlab.com/ee/api/repository_files.html
179 changes: 179 additions & 0 deletions git/gitlab/gitlab-auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@

// gitlab login

window.onload = async () => {

gitToken = getStorage('gitToken') ?? '';

if (gitToken == 'undefined') {
gitToken = '';
}


// decode URL
linkData = decodeLink(window.location.href);

// clear URL
window.history.pushState(window.location.origin, 'Codeit', window.location.origin + '/full');


// if treeLoc is in local storage
if (linkData.dir) {

treeLoc = linkData.dir;
saveTreeLocLS(treeLoc);

} else {

treeLoc = getStorage('tree') ? getStorage('tree').split(',') : ['', '', ''];

// if repo dosen't have a branch (legacy treeLoc)
if (treeLoc[1] && !treeLoc[1].includes(':')) {

// add default branch to repo
treeLoc[1] += ':main';
saveTreeLocLS(treeLoc);

}

}


if (getStorage('loggedUser')) {

loggedUser = getStorage('loggedUser');

try {

loggedUser = JSON.parse(loggedUser);

// save logged user in local storage
setStorage('loggedUser', loggedUser.login);

} catch(e) {}

} else {

loggedUser = false;

}


const authURL = 'https://gitlab.com/oauth/authorize?client_id=f3b94ba233943fa82855c1b495f28c02ccaa11cf276b419d6d1798488a4bb7b0&redirect_uri=https://codeit.codes/git/gitlab/oauth&response_type=code&state=1f3b3477&scope=api';

loginButton.addEventListener('click', () => {

if (isMobile) {

window.location.href = authURL;

} else {

window.open(authURL, 'Login with Gitlab', 'height=575,width=575');

}

})


window.addEventListener('message', (event) => {

// if redirected from git auth
if (event.source.location.pathname === '/git/gitlab/oauth') {

// hide intro screen
sidebar.classList.remove('intro');

// if on safari, refresh header color
if (isSafari) {

document.querySelector('meta[name="theme-color"]').content = '#313744';

onNextFrame(() => {

document.querySelector('meta[name="theme-color"]').content = '#1a1c24';

});

}

// start loading
startLoading();

const gitCode = event.data;

// get git token from Gitlab
getGitlabToken(gitCode);

}

})


loadLS();


// if git code exists in link
if (linkData.gitCode) {

// hide intro screen
sidebar.classList.remove('intro');

// if on safari, refresh header color
if (isSafari) {

document.querySelector('meta[name="theme-color"]').content = '#313744';

onNextFrame(() => {

document.querySelector('meta[name="theme-color"]').content = '#1a1c24';

});

}

// start loading
startLoading();

const gitCode = linkData.gitCode;

// get git token from Gitlab
getGitlabToken(gitCode);

}

}

async function getGitlabToken(gitCode) {

// post to git with clientId, clientSecret and code
const resp = await axios.post('https://gitlab.com/oauth/token?' +
'client_id=f3b94ba233943fa82855c1b495f28c02ccaa11cf276b419d6d1798488a4bb7b0' +
'&client_secret=1a4098e4770f84f01c94df563201d87b39dae740fe910622c76cd05d8ea30d03' +
'&grant_type=authorization_code&redirect_uri=https://codeit.codes/git/gitlab/oauth' +
'&code=' + gitCode);

// save git token to localStorage
gitToken = resp.access_token;
saveGitTokenLS(gitToken);


// get logged user
loggedUser = await axios.get('https://gitlab.com/api/v4/user', gitToken);
loggedUser = loggedUser.username;

// save logged user in local storage
setStorage('loggedUser', loggedUser);


// render sidebar
renderSidebarHTML();

}





await axios.post('https://gitlab.com/oauth/token?client_id=&client_secret=&code=&&redirect_uri=https://codeit.codes/git/gitlab/oauth')

4 changes: 2 additions & 2 deletions homepage/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ document.querySelectorAll('.btn.install').forEach(button => {

} else {

if (localStorage.getItem('installed')) {
//if (localStorage.getItem('installed')) {

button.classList.add('installed');

}
//}

}

Expand Down
2 changes: 1 addition & 1 deletion homepage/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<img class="logo" src="/icons/iphone-app-180.png" width="80" draggable="false" alt="Codeit">
<p class="title">Privacy policy</p>

<div style="display: inline-block;line-height: 1.5;">Codeit dosen't collect data.<br>Your code stays on your device. <br>Codeit uses <a href="https://plausible.io">Plausible</a> to get stats. <br><a href="https://plausible.io/codeit.codes">See the stats.</a></div>
<div style="display: inline-block;line-height: 1.5;">Codeit dosen't collect data.<br>Your code stays on your device. <br>Codeit uses <a href="https://plausible.io">Plausible</a> to get stats. <br><a href="https://plausible.io/codeit.codes?period=all">See the stats.</a></div>
<p style="margin-top: 50px;margin-bottom: 50px;">
<a href="/" style="color: inherit;">- ❤️ Codeit team</a>
</p>
Expand Down
Loading