diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..0836a66
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,25 @@
+name: ci
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+jobs:
+ build_and_publish:
+ runs-on: docker
+ container:
+ image: ghcr.io/catthehacker/ubuntu:runner-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ - run: npm install
+ - run: sudo apt update && sudo apt install -y tar
+ - run: export NODE_OPTIONS=--openssl-legacy-provider
+ - run: npm run build
+ - run: tar cvzf keanu-weblite.tar.gz dist/*
+ - run: |
+ curl -H "Authorization: token ${{ secrets.PACKAGE_TOKEN }}" -X DELETE "https://guardianproject.dev/api/packages/butter/generic/keanu-weblite/latest"
+ - run: |
+ curl -H "Authorization: token ${{ secrets.PACKAGE_TOKEN }}" -X PUT --upload-file keanu-weblite.tar.gz https://guardianproject.dev/api/packages/butter/generic/keanu-weblite/latest/keanu-weblite.tar.gz
diff --git a/package.json b/package.json
index 0f1636d..21aea58 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "keanuapp-weblite",
- "version": "0.1.96",
+ "version": "0.1.91",
"private": true,
"scripts": {
"dev": "vite",
diff --git a/package.json.bak b/package.json.bak
index 69f886f..a0b65f9 100644
--- a/package.json.bak
+++ b/package.json.bak
@@ -1,6 +1,6 @@
{
"name": "keanuapp-weblite",
- "version": "0.1.95",
+ "version": "0.1.90",
"private": true,
"scripts": {
"dev": "vite",
diff --git a/public/offline.html b/public/offline.html
deleted file mode 100644
index 66e64d4..0000000
--- a/public/offline.html
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
{{ $t("logout.confirm_text") }}
-
{{ copyCredentialsSubText }}
-
+ {{ $t("logout.copy_credentials_desc") }}
+
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/Profile.vue b/src/components/Profile.vue
index bce814c..556a7e0 100644
--- a/src/components/Profile.vue
+++ b/src/components/Profile.vue
@@ -116,7 +116,6 @@
>
{{ $matrix.currentUser.is_guest ? $t("profile.set_password") : $t("profile.change_password") }}
- {{ $t("profile.set_password_desc") }}
-
-
-
- {{
- $t("menu.cancel") }}
-
-
- {{ $t("global.save") }}
-
-
-
+
+
+
+ {{
+ $t("menu.cancel")
+ }}
+ {{ $t("global.save") }}
+
@@ -183,35 +180,33 @@
class="ma-0 pa-0"
:width="$vuetify.display.smAndUp ? '940px' : '80%'"
>
-
+
{{ $t("profile.display_name") }}
-
+
-
-
-
- {{
- $t("menu.cancel") }}
-
-
- {{ $t("global.save") }}
-
-
-
-
+
+
+
+
+ {{
+ $t("menu.cancel")
+ }}
+ {{ $t("global.save") }}
+
diff --git a/src/router/index.js b/src/router/index.js
index eeabf54..863587f 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,141 +1,126 @@
-import Home from "../components/Home.vue";
-import Chat from "../components/Chat.vue";
-import Join from "../components/Join.vue";
-import Login from "../components/Login.vue";
-import Profile from "../components/Profile.vue";
-import CreateRoom from "../components/CreateRoom.vue";
-import GetLink from "../components/GetLink.vue";
-import Create from "../components/Create.vue";
-import CreateChannel from "../components/CreateChannel.vue";
-import CreateFileDrop from "../components/CreateFileDrop.vue";
-import User from "../models/user";
-import util from "../plugins/utils";
-import { createRouter, createWebHashHistory } from "vue-router";
-import { defineAsyncComponent } from "vue";
-import { STORE_KEY_SETTINGS, STORE_KEY_USER } from "../store";
+import Home from '../components/Home.vue'
+import Chat from '../components/Chat.vue'
+import Join from '../components/Join.vue'
+import Login from '../components/Login.vue'
+import Profile from '../components/Profile.vue'
+import CreateRoom from '../components/CreateRoom.vue'
+import GetLink from '../components/GetLink.vue'
+import Create from '../components/Create.vue'
+import CreateChannel from '../components/CreateChannel.vue'
+import CreateFileDrop from '../components/CreateFileDrop.vue'
+import User from '../models/user'
+import util from '../plugins/utils'
+import { createRouter, createWebHashHistory } from 'vue-router'
+import { defineAsyncComponent } from 'vue'
const routes = [
{
- path: "/",
- name: "Home",
- component: Home,
+ path: '/',
+ name: 'Home',
+ component: Home
},
{
- path: "/room/:join(join/)?:roomId?",
- name: "Chat",
+ path: '/room/:join(join/)?:roomId?',
+ name: 'Chat',
component: Chat,
meta: {
includeRoom: true,
- includeFavicon: true,
+ includeFavicon: true
},
},
{
- path: "/info",
- name: "RoomInfo",
- component: () => import("../components/RoomInfo.vue"),
+ path: '/info',
+ name: 'RoomInfo',
+ component: () => import('../components/RoomInfo.vue'),
props: true,
meta: {
- title: "Info",
+ title: 'Info',
includeRoom: true,
- includeFavicon: true,
- },
+ includeFavicon: true
+ }
},
{
- path: "/profile",
- name: "Profile",
+ path: '/profile',
+ name: 'Profile',
component: Profile,
meta: {
- title: "Profile",
- includeFavicon: true,
- },
+ title: 'Profile',
+ includeFavicon: true
+ }
},
{
- path: "/createroom",
- name: "CreateRoom",
+ path: '/createroom',
+ name: 'CreateRoom',
component: CreateRoom,
meta: {
- title: "Create room",
- },
+ title: 'Create room'
+ }
},
{
- path: "/getlink",
- name: "GetLink",
+ path: '/getlink',
+ name: 'GetLink',
component: GetLink,
},
{
- path: "/create",
- name: "Create",
+ path: '/create',
+ name: 'Create',
component: Create,
},
{
- path: "/createchannel",
- name: "CreateChannel",
+ path: '/createchannel',
+ name: 'CreateChannel',
component: CreateChannel,
},
{
- path: "/createfiledrop",
- name: "CreateFileDrop",
+ path: '/createfiledrop',
+ name: 'CreateFileDrop',
component: CreateFileDrop,
},
{
- path: "/login",
- name: "Login",
+ path: '/login',
+ name: 'Login',
component: Login,
- props: true,
+ props: true
},
{
- path: "/join/:join(join/)?:roomId?",
- name: "Join",
+ path: '/join/:join(join/)?:roomId?',
+ name: 'Join',
component: Join,
- props: (route) => {
+ props: route => {
return {
- roomNeedsKnock: route.query.knock ? true : false,
- roomDisplayName: route.query.roomName,
- };
- },
+ roomNeedsKnock: (route.query.knock ? true : false),
+ roomDisplayName: route.query.roomName
+ }
+ }
},
{
- path: "/user/:userId?",
- name: "User",
- component: Join,
+ path: '/user/:userId?',
+ name: 'User',
+ component: Join
},
{
- path: "/invite/:roomId?",
- name: "Invite",
- component: defineAsyncComponent(() => import("../components/Invite.vue")),
+ path: '/invite/:roomId?',
+ name: 'Invite',
+ component: defineAsyncComponent(() => import('../components/Invite.vue')),
meta: {
- title: "Add Friends",
- },
+ title: 'Add Friends'
+ }
},
{
- path: "/goodbye",
- name: "Goodbye",
- component: defineAsyncComponent(() => import("../components/QuoteView.vue")),
- props: true,
- },
- {
- path: "/migrating",
- name: "Migrating",
- component: defineAsyncComponent(() => import("../components/MigratingView.vue")),
- props: false,
- },
-];
+ path: '/goodbye',
+ name: 'Goodbye',
+ component: defineAsyncComponent(() => import('../components/QuoteView.vue')),
+ props: true
+ }
+]
const router = createRouter({
history: createWebHashHistory(),
- routes: routes,
+ routes: routes
});
router.beforeEach((to, from, next) => {
- const publicPages = [
- "/login",
- "/createroom",
- "/getlink",
- "/create",
- "/createchannel",
- "/createfiledrop",
- "/migrating",
- ];
+ const publicPages = ['/login', '/createroom', '/getlink', '/create', '/createchannel', '/createfiledrop'];
var authRequired = !publicPages.includes(to.path);
const loggedIn = router.app.$store.state.auth.user;
@@ -143,45 +128,15 @@ router.beforeEach((to, from, next) => {
// Set language via query param
const lang = to.query.lang;
// Check if valid translation
- if (router.app.$i18n && router.app.$i18n.global && router.app.$i18n.global.messages[lang]) {
- router.app.$store.commit("setLanguage", lang);
- router.app.$i18n.global.locale = to.query.lang;
+ if (router.app.$i18n.messages[lang]) {
+ router.app.$store.commit('setLanguage', lang);
+ if (router.app.$i18n) {
+ router.app.$i18n.locale = to.query.lang;
+ }
}
}
- if (to.query && to.query.migrate) {
- try {
- if (window.opener) {
- console.log("Start listening for migration messages");
- window.addEventListener("message", function (e) {
- // if (e.origin !== origin) { // TODO - What should we check here?
- // return
- // }
- try {
- const data = JSON.parse(e.data);
- if (data !== null) {
- router.app.$store
- .dispatch("migrate", data)
- .then(() => {
- console.log("Migration success");
- })
- .catch((error) => {
- console.log("Migration error", error);
- })
- .finally(() => {
- window.opener.postMessage(JSON.stringify({ cmd: "migrationDone" }), "*");
- router.app.$navigation.push({ name: "Home" }, -1);
- });
- }
- } catch (error) {}
- });
- window.opener.postMessage(JSON.stringify({ cmd: "getMigrationData" }), "*");
- }
- return next("/migrating");
- } catch (error) {}
- }
-
- if (to.name == "Chat" || to.name == "Join") {
+ if (to.name == 'Chat' || to.name == 'Join') {
if (!to.params.roomId && to.hash) {
// Public rooms start with '#', confuses the router. If hash but no roomId param, set it.
to.params.roomId = to.hash;
@@ -192,84 +147,62 @@ router.beforeEach((to, from, next) => {
//Invite to public room
authRequired = false;
}
- } else if (to.name == "Home") {
+ } else if (to.name == 'Home') {
if (to.params.roomId !== undefined) {
const roomId = to.params.roomId ? util.sanitizeRoomId(to.params.roomId) : null;
router.app.$matrix.setCurrentRoomId(roomId);
}
- } else if (to.name == "User") {
+ } else if (to.name == 'User') {
if (to.params.userId) {
let roomId = util.sanitizeUserId(to.params.userId);
if (roomId && !roomId.startsWith("@")) {
// Not a full username. Assume local name on this server.
- return router.app.$config
- .load()
- .then((config) => {
- const domain = config.defaultMatrixDomainPart;
- if (!domain) throw new Error("No domain part for user invite!");
- roomId = "@" + roomId + ":" + domain;
- router.app.$matrix.setCurrentRoomId(roomId);
- })
- .catch((err) => console.error(err))
- .finally(() => next());
+ return router.app.$config.load().then((config) => {
+ const domain = config.defaultMatrixDomainPart;
+ if (!domain) throw new Error("No domain part for user invite!");
+ roomId = "@" + roomId + ":" + domain;
+ router.app.$matrix.setCurrentRoomId(roomId);
+ }).catch(err => console.error(err)).finally(() => next());
} else {
router.app.$matrix.setCurrentRoomId(roomId);
authRequired = false;
}
}
- } else if (to.name == "Invite") {
+ } else if (to.name == 'Invite') {
if (to.params.roomId) {
const roomId = util.sanitizeRoomId(to.params.roomId);
router.app.$matrix.setCurrentRoomId(roomId);
}
- } else if (to.name == "CreateRoom") {
- return router.app.$config
- .load()
- .then((config) => {
- if (config.hide_add_room_on_home || !config.roomTypes.includes("group_chat")) {
- next("/");
- } else {
- next();
- }
- })
- .catch((err) => {
- console.error(err);
- next("/");
- });
- } else if (to.name == "CreateChannel") {
- return router.app.$config
- .load()
- .then((config) => {
- if (!config.roomTypes.includes("channel")) {
- next("/");
- } else {
- next();
- }
- })
- .catch((err) => {
- console.error(err);
- next("/");
- });
- } else if (to.name == "CreateFileDrop") {
- return router.app.$config
- .load()
- .then((config) => {
- if (!config.roomTypes.includes("file_drop")) {
- next("/");
- } else {
- next();
- }
- })
- .catch((err) => {
- console.error(err);
- next("/");
- });
+ } else if (to.name == 'CreateRoom') {
+ return router.app.$config.load().then((config) => {
+ if (config.hide_add_room_on_home || !config.roomTypes.includes("group_chat")) {
+ next('/');
+ } else {
+ next();
+ }
+ }).catch(err => { console.error(err); next('/'); });
+ } else if (to.name == 'CreateChannel') {
+ return router.app.$config.load().then((config) => {
+ if (!config.roomTypes.includes("channel")) {
+ next('/');
+ } else {
+ next();
+ }
+ }).catch(err => { console.error(err); next('/'); });
+ } else if (to.name == 'CreateFileDrop') {
+ return router.app.$config.load().then((config) => {
+ if (!config.roomTypes.includes("file_drop")) {
+ next('/');
+ } else {
+ next();
+ }
+ }).catch(err => { console.error(err); next('/'); });
}
// trying to access a restricted page + not logged in
// redirect to login page
if (authRequired && !loggedIn) {
- next("/login");
+ next('/login');
} else {
next();
}
@@ -292,21 +225,12 @@ router.getRoomLink = function (alias, roomId, roomName, mode, autojoin, knock, m
const autoJoinSegment = autojoin ? "join/" : "";
let queryString = "";
if (Object.entries(params).length > 0) {
- queryString =
- "?" +
- Object.entries(params)
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
- .join("&");
+ queryString = "?" + Object.entries(params)
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
+ .join('&')
}
- return (
- (mirror ? window.location.protocol + "//" + mirror : window.location.origin) +
- window.location.pathname +
- "#/room/" +
- autoJoinSegment +
- encodeURIComponent(util.sanitizeRoomId(alias || roomId)) +
- queryString
- );
-};
+ return (mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId)) + queryString;
+}
router.getDMLink = function (user, config, mirror) {
let userId = user.user_id;
@@ -314,9 +238,7 @@ router.getDMLink = function (user, config, mirror) {
// Using default server, don't include it in the link
userId = User.localPart(user.user_id);
}
- return `${
- (mirror ? window.location.protocol + "//" + mirror : window.location.origin) + window.location.pathname
- }#/user/${encodeURIComponent(userId)}`;
-};
+ return `${(mirror ? (window.location.protocol + "//" + mirror) : window.location.origin) + window.location.pathname}#/user/${encodeURIComponent(userId)}`
+}
-export default router;
+export default router
diff --git a/src/services/matrix.service.js b/src/services/matrix.service.js
index 993d003..cbe284c 100644
--- a/src/services/matrix.service.js
+++ b/src/services/matrix.service.js
@@ -141,32 +141,7 @@ export default {
}
return this.legacyCryptoStore;
},
- migrate(user) {
- return util.getMatrixBaseUrl(user, this.$config)
- .then((baseUrl) => {
- console.log("Create temp client", user);
- const tempMatrixClient = sdk.createClient({
- baseUrl: baseUrl,
- idBaseUrl: this.$config.identityServer,
- });
- user.access_token = undefined;
- user.device_id = tempMatrixClient.getSessionId();
- if (user.refresh_token) {
- return this.refreshAccessToken(tempMatrixClient, user.refresh_token);
- } else {
- return Promise.resolve(true);
- }
- }).then(() => {
- console.log("Refresh done, normal login");
- return this.login(user, undefined, false, true);
- });
- },
- login(user, registrationFlowHandler, createUser = false, isMigration = false) {
- if (!isMigration && window.location.href.includes("migrate=1")) {
- console.log("Migrate, so no login!");
- return Promise.reject("Migrating, so no login");
- }
-
+ login(user, registrationFlowHandler, createUser = false) {
return util.getMatrixBaseUrl(user, this.$config).then((baseUrl) => {
const tempMatrixClient = sdk.createClient({
baseUrl: baseUrl,
@@ -535,16 +510,12 @@ export default {
},
onSessionRefresh(refreshToken) {
- return this.refreshAccessToken(this.matrixClient, refreshToken);
- },
-
- refreshAccessToken(matrixClient, refreshToken) {
if (this.tokenRefreshPromise) {
return this.tokenRefreshPromise;
}
const now = Date.now();
this.tokenRefreshPromise =
- matrixClient.http.request(sdk.Method.Post, "/refresh", undefined, { refresh_token: refreshToken}, { prefix: sdk.ClientPrefix.V3, inhibitLogoutEmit: true }).then((result) => {
+ this.matrixClient.http.request(sdk.Method.Post, "/refresh", undefined, { refresh_token: refreshToken}, { prefix: sdk.ClientPrefix.V3, inhibitLogoutEmit: true }).then((result) => {
// Store new one!
var user = this.$store.state.auth.user;
user.access_token = result.access_token;
diff --git a/src/store/index.js b/src/store/index.js
index 16fc704..1b3c597 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -136,33 +136,6 @@ const store = createStore({
this.$matrix.logout();
commit('logout');
},
- migrate({ state }, migrationData) {
- if (migrationData && migrationData.type) {
- let storage = migrationData.type == "session" ? sessionStorage : localStorage;
- if (migrationData.settings) {
- try {
- const settings = JSON.parse(migrationData.settings);
- storage.setItem(STORE_KEY_SETTINGS, migrationData.settings);
- state.useLocalStorage = migrationData.type != "session";
- } catch (error) {
- console.error("Failed to migrate settings", error);
- }
- }
- if (migrationData.user) {
- const user = JSON.parse(migrationData.user);
- state.auth.user = user;
- return this.$matrix.migrate(user).then(
- (user) => {
- return Promise.resolve(user);
- },
- (error) => {
- return Promise.reject(error);
- }
- );
- }
- }
- return Promise.reject("Migration error");
- }
},
getters: {
storage: state => {