From d9ea74ad0e42cd888239fb6ea8a79ea84e2efa5c Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Thu, 28 Apr 2022 19:20:51 +0300
Subject: [PATCH 01/35] Update full.html
---
full.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/full.html b/full.html
index c752f01e97..cc67266b39 100644
--- a/full.html
+++ b/full.html
@@ -247,6 +247,7 @@
+
From e4a791adaaa8f6d40ba2ed033fc4e685dc907c50 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:31:37 +0300
Subject: [PATCH 02/35] Update full.html
---
full.html | 1 -
1 file changed, 1 deletion(-)
diff --git a/full.html b/full.html
index cc67266b39..c752f01e97 100644
--- a/full.html
+++ b/full.html
@@ -247,7 +247,6 @@
-
From 4542da0c136eefd31457c3d677c6ef56ec5a50d0 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:52:12 +0300
Subject: [PATCH 03/35] Create gitlab-auth.js
---
git/gitlab-auth.js | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 git/gitlab-auth.js
diff --git a/git/gitlab-auth.js b/git/gitlab-auth.js
new file mode 100644
index 0000000000..a4057876f7
--- /dev/null
+++ b/git/gitlab-auth.js
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
From e53f43d7104679183f6d1648f52ea5e0843dcb61 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:52:17 +0300
Subject: [PATCH 04/35] Update gitlab-auth.js
---
git/gitlab-auth.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/git/gitlab-auth.js b/git/gitlab-auth.js
index a4057876f7..d3f5a12faa 100644
--- a/git/gitlab-auth.js
+++ b/git/gitlab-auth.js
@@ -1,2 +1 @@
-
\ No newline at end of file
From f41faa898d1ca8f452b1207cb04f9f16b7d7fbfb Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:57:55 +0300
Subject: [PATCH 05/35] Update gitauth.js
---
git/gitauth.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/git/gitauth.js b/git/gitauth.js
index 498862d19e..2af7e2651f 100644
--- a/git/gitauth.js
+++ b/git/gitauth.js
@@ -1,6 +1,3 @@
-/*
- github
-*/
// git login
From 8046fc16e1c3b6c79884ac248fffdff0197505d5 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:58:11 +0300
Subject: [PATCH 06/35] Update codedrop.js
---
codedrop.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/codedrop.js b/codedrop.js
index d6406405f4..a037a3a687 100644
--- a/codedrop.js
+++ b/codedrop.js
@@ -1,3 +1,4 @@
+
function getFileLang(src) {
var lang_aliases = /*aliases_placeholder[*/ {
From 2955c3de526abbd78c3c665f7350f866c4e1a731 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:58:16 +0300
Subject: [PATCH 07/35] Update filebrowser.js
---
filebrowser.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/filebrowser.js b/filebrowser.js
index 112dfd15b3..b5d2502326 100644
--- a/filebrowser.js
+++ b/filebrowser.js
@@ -1,6 +1,3 @@
-/*
- github
-*/
// show bookmark on hover
sidebarToggle.addEventListener('mouseover', () => {
From 33a6d37cfb1095f165eabd78416df5242d7cc93d Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:59:05 +0300
Subject: [PATCH 08/35] Update codeit.js
---
lib/codeit.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/codeit.js b/lib/codeit.js
index 953d6110b0..5c8e76e3cb 100644
--- a/lib/codeit.js
+++ b/lib/codeit.js
@@ -1,7 +1,3 @@
-/*
- github
-*/
-
/*
codeit.js
From 44c7945aa47f051f02692a54345095479ec93ecb Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 10:59:53 +0300
Subject: [PATCH 09/35] Update gitauth.js
---
git/gitauth.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git/gitauth.js b/git/gitauth.js
index 2af7e2651f..189ea253d6 100644
--- a/git/gitauth.js
+++ b/git/gitauth.js
@@ -1,5 +1,5 @@
-// git login
+// github login
window.onload = async () => {
From f474938ecd293b3de76fb44c3d61b416b4325fdb Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:07:51 +0300
Subject: [PATCH 10/35] Update gitlab-auth.js
---
git/gitlab-auth.js | 180 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 179 insertions(+), 1 deletion(-)
diff --git a/git/gitlab-auth.js b/git/gitlab-auth.js
index d3f5a12faa..d12b53b887 100644
--- a/git/gitlab-auth.js
+++ b/git/gitlab-auth.js
@@ -1 +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/login') {
+
+ // 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://api.github.com/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')
+
From 846bb555f31125866e1e28485eb196b22dd6d53f Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:09:33 +0300
Subject: [PATCH 11/35] Update gitauth.js
---
git/gitauth.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/git/gitauth.js b/git/gitauth.js
index 189ea253d6..68cfc03bc6 100644
--- a/git/gitauth.js
+++ b/git/gitauth.js
@@ -59,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');
}
@@ -77,7 +79,7 @@ window.onload = async () => {
window.addEventListener('message', (event) => {
// if redirected from git auth
- if (event.source.location.pathname === '/git/login') {
+ if (event.source.location.pathname === '/git/github/oauth') {
// hide intro screen
sidebar.classList.remove('intro');
From e8a699f292233785284ed85206b46ae6ad7f0637 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:09:49 +0300
Subject: [PATCH 12/35] Update gitlab-auth.js
---
git/gitlab-auth.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git/gitlab-auth.js b/git/gitlab-auth.js
index d12b53b887..ff32421126 100644
--- a/git/gitlab-auth.js
+++ b/git/gitlab-auth.js
@@ -79,7 +79,7 @@ window.onload = async () => {
window.addEventListener('message', (event) => {
// if redirected from git auth
- if (event.source.location.pathname === '/git/gitlab/login') {
+ if (event.source.location.pathname === '/git/gitlab/oauth') {
// hide intro screen
sidebar.classList.remove('intro');
From a2338f69515161d4e6584274c91059e5069496f8 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:37:15 +0300
Subject: [PATCH 13/35] Create gitlab-api.js
---
git/gitlab-api.js | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 git/gitlab-api.js
diff --git a/git/gitlab-api.js b/git/gitlab-api.js
new file mode 100644
index 0000000000..c9c976c686
--- /dev/null
+++ b/git/gitlab-api.js
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
From 7ae163d13f58bffad373ac15ef621ea663adf225 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:37:38 +0300
Subject: [PATCH 14/35] Update gitlab-auth.js
---
git/gitlab-auth.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git/gitlab-auth.js b/git/gitlab-auth.js
index ff32421126..4bc70082bd 100644
--- a/git/gitlab-auth.js
+++ b/git/gitlab-auth.js
@@ -159,7 +159,7 @@ async function getGitlabToken(gitCode) {
// get logged user
- loggedUser = await axios.get('https://api.github.com/user', gitToken);
+ loggedUser = await axios.get('https://gitlab.com/api/v4/user', gitToken);
loggedUser = loggedUser.username;
// save logged user in local storage
From 12d64516b29fe11f46d2722ffc62ed14e49b6994 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:45:54 +0300
Subject: [PATCH 15/35] Update utils.js
From 74abb04f2b17a09d342b1bebf3c399c4399106ec Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:46:15 +0300
Subject: [PATCH 16/35] Update gitlab-api.js
---
git/gitlab-api.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/git/gitlab-api.js b/git/gitlab-api.js
index c9c976c686..24e9d530e9 100644
--- a/git/gitlab-api.js
+++ b/git/gitlab-api.js
@@ -1,2 +1 @@
-
-
\ No newline at end of file
+https://gitlab.com/api/v4/projects?access_token=19a48ef34811b9425b6fc1e4c75f1358bdf7f528d151ec5624c46fa61e8b4c03&order_by=updated_at&min_access_level=30
From e3db8667ad88e89531d9e7a66cfe740a66b608f6 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:47:45 +0300
Subject: [PATCH 17/35] Update gitlab-api.js
---
git/gitlab-api.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/git/gitlab-api.js b/git/gitlab-api.js
index 24e9d530e9..eb3d9bd13d 100644
--- a/git/gitlab-api.js
+++ b/git/gitlab-api.js
@@ -1 +1,2 @@
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
From 65ef016d97fa3fce5fd7948421534e0d053ecc1e Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Fri, 29 Apr 2022 11:48:05 +0300
Subject: [PATCH 18/35] Update gitlab-api.js
---
git/gitlab-api.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/git/gitlab-api.js b/git/gitlab-api.js
index eb3d9bd13d..f1ee72129b 100644
--- a/git/gitlab-api.js
+++ b/git/gitlab-api.js
@@ -1,2 +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
From 49d1904c22af4ceb957cdb5958530d04c66760cc Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Sat, 30 Apr 2022 09:14:39 +0300
Subject: [PATCH 19/35] Update service-worker.js
---
service-worker.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/service-worker.js b/service-worker.js
index fadd54a7e9..12193ef5bb 100644
--- a/service-worker.js
+++ b/service-worker.js
@@ -82,9 +82,9 @@ self.addEventListener('activate', (evt) => {
);
// send reload request to client
- workerChannel.postMessage({
+ /*workerChannel.postMessage({
type: 'reload'
- });
+ });*/
});
From adc3b891a2f53e5ea4001b973d46a121ca62e329 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Sat, 30 Apr 2022 18:03:40 +0300
Subject: [PATCH 20/35] Update index.html
---
index.html | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/index.html b/index.html
index 38b47cdbaf..83098a65b2 100644
--- a/index.html
+++ b/index.html
@@ -14,38 +14,39 @@
-
+
-
+
-
-
+
+
-
+
+
+
+
-
-
+
+
-
-
-
-
+
+
From ad06e869bdb22fd770b92469ba1ae0e9e5c005f4 Mon Sep 17 00:00:00 2001
From: Bar Hatsor <34835685+barhatsor@users.noreply.github.com>
Date: Sat, 30 Apr 2022 18:04:04 +0300
Subject: [PATCH 21/35] Update privacy.html
---
homepage/privacy.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/homepage/privacy.html b/homepage/privacy.html
index 61623516ad..d7b1bc3491 100644
--- a/homepage/privacy.html
+++ b/homepage/privacy.html
@@ -140,7 +140,7 @@
Privacy policy
-J~ 5r&jPXLVF`IU6
zrw2*h3oYak8rF6$Nxc^=yAFvX;`$k5EEbg4B)n+Y@4Y6t@SB3B*oE9P<51E4G-Cn-
zqCKHl&nexlXjcJp;>!w&WFAeqLvz0Pz4C)|>w@=dx4E5NGzCOw9o=WDpG~7S(Zd%N
z3k8(N47QNk?@|US!IOZZc*^i^;RU$U1hPB&!t%Y5(dhIX=keCmAaHnO@8ISqaGY*}
zw0cd(Vh#sdkMPg`-4`-oH?Cu!K~IC|Us+pnJo|iag?8ut_UFjOGyMxM_sY73C+H*M
zlHvS;^qr$>(*oSiek~RYPUd0pXsO0Vro -yl|Y?Ta$F@}It$K?~&V`q@hJwN__8~pE~&i{5Eyn%M}
z2JGC;8|Q!PzLkNn=iv|x`n1h8Yp=#S%cXs>qn^>JHm~XH<4-%vD~@`PXLh9ot@m9>
z^0$VZc_!pp%}YhqsJqVPoa#zPboSdXbB9aLHTD*|;utq8VvZw*{8ycOjC`633}6pc
z6d1r2;MFoV!(LU70J8LX-(nw$@@8GIt`do=
zK4Bf|(yan+5`jgUpxWhHO=36ccb>L(1*P-?izH#>_Bei3(f2QQvpRwA%o|s_gc`C`
z+k<`S^_m+V6y9)3{Ayf+OuUF=gy`|q0CqU9jWz2any=pHgp8m9MjW_SrF{8BTmc%n
z>3H9}R{@=0V%S0Kar=;Sg?C?BP
eAs;ts+(@Qj~w?D6|*U*tmM`*Oi%3PpDdWHMfYeL
z^cr6Ip7~$n7!e?Y6#&&aR3kr^23^Cth4%H#t)&7DmH7AKi=IkZg~|euh9l^80hU4X
zESrz|r$FLb*4DBLLIgN}B%Z#S)~X8>;E!yV{U2iaRSC4B|B_JtwMAh4uG;4wRR0ER
z%f1-s^ana0K`R?XOs|N`^ka^6t>yjsV1?0(CJKZC?icW*u7m;dZwywmFc1^8s@Kw?
z_LCv!Qiw@5y_P|l(>?skG`K`aNpxt<(xsfG82T#)zdv6e_@dYM1@~sF>X@Ff%6>cS
zi^5BYtW|D2-%Z)s=UKMYJkZ1K