Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Main to Dev #19

Merged
merged 24 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
60b2aa3
Merge pull request #17 from stanleyowen/dev
stanleyowen Apr 21, 2023
bee99e7
Merge pull request #18 from stanleyowen/dev
stanleyowen Apr 22, 2023
cdddc8c
Convert to `boolean` if possible
stanleyowen Apr 22, 2023
5358532
Added MIT License
stanleyowen Apr 22, 2023
72bca5b
optimized codebase quality
stanleyowen Apr 22, 2023
ff0ffdd
refactor: added `uid` path for sending msg
stanleyowen Apr 27, 2023
00afd3b
feat: added ability to send reminder to multiple `id`
stanleyowen Apr 27, 2023
a1208c5
feat: replace `nickname` with user name
stanleyowen Apr 28, 2023
e07223b
fix: remove duplicates except for `command`
stanleyowen Apr 28, 2023
6d6013c
feat: added dynamic channel access token
stanleyowen Apr 28, 2023
e8a538e
feat: change channel access token when limit exceeded
stanleyowen Apr 28, 2023
0d7924d
fix: error in updating more then 25 items
stanleyowen Apr 29, 2023
c9a9a74
feat: added ability to reset env
stanleyowen Apr 29, 2023
bdd58d3
fix: fixed connection closed before request completed
stanleyowen Apr 30, 2023
8848b7e
feat: added discord integration
stanleyowen Apr 30, 2023
ab4adac
deprecated discord support
stanleyowen Apr 30, 2023
4f56a0c
deprecated `bluebird`, `inquirer`, `discord.js` deps
stanleyowen Apr 30, 2023
a0f4700
Fix: Cannot read properties of null (reading '0')
stanleyowen May 6, 2023
a2d636e
Fix: Undefined `reason` and `promise` value in webhook
stanleyowen May 6, 2023
1eed9ff
refactor: push webhook to each category
stanleyowen May 6, 2023
66e3770
fix: fixed issue of app crash when multiple id is supplied
stanleyowen May 7, 2023
10ffb3e
fix: call `updateClientToken()` when limit exceeded
stanleyowen May 20, 2023
1d96d2a
feat: supports sticker reply
stanleyowen Jun 8, 2023
dc3cfc9
bump dependencies to the latest version
stanleyowen Jun 8, 2023
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
2 changes: 1 addition & 1 deletion client/LICENSE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Logger Dashboard
Copyright (c) 2023 Edelweiss

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 9 additions & 0 deletions Privacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**Privacy Policy**

_Personal Information Collection_

Edelweiss collects and stores information to provide our services.

_Non-Personal Information Collection_

Edelweiss collects and stores data which are useful for logging, bugs, and fix crashes. All information sent is anonymous and free of any user or contextual data.
22 changes: 11 additions & 11 deletions client/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
env:
browser: true
es2021: true
browser: true
es2021: true
extends:
- 'eslint:recommended'
- 'plugin:react/recommended'
- 'plugin:@typescript-eslint/recommended'
- 'eslint:recommended'
- 'plugin:react/recommended'
- 'plugin:@typescript-eslint/recommended'
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 12
sourceType: module
ecmaFeatures:
jsx: true
ecmaVersion: 12
sourceType: module
plugins:
- react
- '@typescript-eslint'
- react
- '@typescript-eslint'
rules: {}
9 changes: 0 additions & 9 deletions client/Privacy.md

This file was deleted.

2 changes: 1 addition & 1 deletion client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Logger Dashboard</title>
<title>Edelweiss</title>
</head>
<body style="-webkit-app-region: drag">
<noscript>
Expand Down
29 changes: 14 additions & 15 deletions client/src/components/about.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const About = () => {
<div className="flex w-80">
<AboutOutline />
<div className="ml-10">
<p>Logger Dashboard</p>
<p>Edelweiss</p>
<p className="small">Version: {packageInfo.version}</p>
</div>
</div>
Expand Down Expand Up @@ -92,7 +92,7 @@ const About = () => {
className="p-15 w-100 no-capitalization"
onClick={() =>
window.open(
'https://github.com/stanleyowen/logger/issues/new/choose'
'https://github.com/stanleyowen/edelweiss/issues/new/choose'
)
}
>
Expand All @@ -106,7 +106,7 @@ const About = () => {
className="p-15 w-100 no-capitalization"
onClick={() =>
window.open(
'https://github.com/stanleyowen/logger/releases'
'https://github.com/stanleyowen/edelweiss/releases'
)
}
>
Expand All @@ -120,7 +120,7 @@ const About = () => {
className="p-15 w-100 no-capitalization"
onClick={() =>
window.open(
'https://github.com/stanleyowen/logger/graphs/contributors'
'https://github.com/stanleyowen/edelweiss/graphs/contributors'
)
}
>
Expand All @@ -144,17 +144,16 @@ const About = () => {
<i>Personal Information Collection</i>
</p>
<p>
Logger Dashboard collects and stores information to
provide our services.
Edelweiss collects and stores information to provide our
services.
</p>
<p className="mt-10">
<i>Non-Personal Information Collection</i>
</p>
<p>
Logger Dashboard collects and stores data which are
useful for logging, bugs, and fix crashes. All
information sent is anonymous and free of any user or
contextual data.
Edelweiss collects and stores data which are useful for
logging, bugs, and fix crashes. All information sent is
anonymous and free of any user or contextual data.
</p>
</div>
</Accordion>
Expand All @@ -168,11 +167,11 @@ const About = () => {
</AccordionSummary>
<div className="p-10">
<p>
Logger Dashboard is an open source project published
under the MIT License. You can view the source code and
contribute to this project on{' '}
Edelweiss is an open source project published under the
MIT License. You can view the source code and contribute
to this project on{' '}
<a
href="https://github.com/stanleyowen/loofi-dashboard"
href="https://github.com/stanleyowen/edelweiss"
target="_blank"
rel="noreferrer"
>
Expand All @@ -182,7 +181,7 @@ const About = () => {
</p>
<code>
<p className="mt-10">
<b>Copyright (c) 2022 Logger Dashboard</b>
<b>Copyright (c) 2022 Edelweiss</b>
</p>
<p className="mt-10">
Permission is hereby granted, free of charge, to any
Expand Down
49 changes: 1 addition & 48 deletions client/src/components/app.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,15 @@ type TransitionProps = Omit<SlideProps, 'direction'>;
const App = ({ properties, handleChange, config }: any) => {
const HOST_DOMAIN: string =
process.env.REACT_APP_HOST_DOMAIN ?? window.location.origin;
const musicSession = JSON.parse(
localStorage.getItem('music-session') || '{}'
);
const [data, setData] = useState<any>([]);
const [rawData, setRawData] = useState<any>({});
const [isOffline, setConnectionState] = useState<boolean>(false);
const [transition, setTransition] = useState<
React.ComponentType<TransitionProps> | undefined
>(undefined);
const [song, setSong] = useState({
playing: false,
title: musicSession.title ? musicSession.title : 'Underwater',
author: musicSession.author ? musicSession.author : 'LiQWYD',
image: musicSession.image
? HOST_DOMAIN + musicSession.image
: 'https://user-images.githubusercontent.com/69080584/129511233-dd5a0eac-2675-415e-ae4c-6cc530a23629.png',
audio: musicSession.audio
? new Audio(musicSession.audio)
: new Audio(
'https://user-images.githubusercontent.com/69080584/129511300-e88655e9-687f-4d0b-acb4-b32c0fa988cf.mp4'
),
});

useEffect(() => {
initializeApp(config);
onValue(ref(getDatabase(), 'loofi-music/'), (snapshot) => {
const data = snapshot.val();
setRawData(snapshot.val());
let index = data ? data.length : 0,
randIndex;
while (index !== 0) {
randIndex = Math.floor(Math.random() * index);
index--;
[data[index], data[randIndex]] = [data[randIndex], data[index]];
}
setData(data);
});

if (document.readyState === 'complete') {
onValue(ref(getDatabase(), '.info/connected'), (snapshot) => {
Expand Down Expand Up @@ -90,36 +62,17 @@ const App = ({ properties, handleChange, config }: any) => {
backgroundElement.style.background = `url(${themeURL})`;
}, []); // eslint-disable-line

const handleSong = useCallback(
(a: any) => {
if (!a.id && !a.value) {
localStorage.setItem('music-session', JSON.stringify(a));
a.audio === song.audio.getAttribute('src')
? setSong({ ...song, playing: !song.playing })
: setSong({
...a,
audio: new Audio(a.audio),
image: HOST_DOMAIN + a.image,
playing: true,
});
} else setSong({ ...song, [a.id]: a.value });
},
[song]
);

return (
<div>
{data.length === 0 ? <LinearProgress /> : null}
{data === 0 ? <LinearProgress /> : null}
<div
className="app"
style={data.length === 0 ? { height: '99.3vh' } : {}}
>
<Navbar properties={properties} handleChange={handleChange} />
<BaseLayout
song={song}
songData={data}
rawSongData={rawData}
handleSong={handleSong}
properties={properties}
HOST_DOMAIN={HOST_DOMAIN}
handleChange={handleChange}
Expand Down
4 changes: 0 additions & 4 deletions client/src/components/base.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import Environment from './env.component';

// eslint-disable-next-line
const BaseLayout = ({
song,
properties,
songData,
handleSong,
HOST_DOMAIN,
handleChange,
}: any) => {
Expand All @@ -20,8 +18,6 @@ const BaseLayout = ({
{properties.activeTab === 'home' ? (
<Home
properties={properties}
handleSong={handleSong}
song={song}
songData={songData}
HOST_DOMAIN={HOST_DOMAIN}
handleChange={handleChange}
Expand Down
13 changes: 10 additions & 3 deletions client/src/components/env.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ const Environment = ({ HOST_DOMAIN }: any) => {
key,
value: (value as any).toString(),
}));
console.log(data);
setEnv(data);
});
}

useEffect(() => {
getEnv(properties.appName);
if (properties.appName) getEnv(properties.appName);
}, [properties.appName]);

const SubmitEnv = (method: 'update' | 'add' | 'delete') => {
Expand All @@ -88,7 +87,15 @@ const Environment = ({ HOST_DOMAIN }: any) => {
let body;

if (method === 'delete') body = { [data.key]: null };
else body = { [data.key]: data.value };
else
body = {
[data.key]:
data.value === 'true'
? true
: data.value === 'false'
? false
: data.value,
};

if (method === 'add' || method === 'update')
axios
Expand Down
23 changes: 5 additions & 18 deletions client/src/components/home.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { MusicOutline, SettingsOutline } from '../lib/icons.component';
import { License, MusicOutline, SettingsOutline } from '../lib/icons.component';

const Home = ({ song, properties, handleChange }: any) => {
const Home = ({ properties, handleChange }: any) => {
const [greeting, setGreeting] = useState<string>();

useEffect(() => {
Expand All @@ -11,15 +11,6 @@ const Home = ({ song, properties, handleChange }: any) => {
else setGreeting('Evening');
}, []);

useEffect(() => {
const btn = document.getElementById(
(song.title + song.author).replace(/\s/g, '-')
);
song.playing
? btn?.classList.add('pause')
: btn?.classList.remove('pause');
}, [song]);

const switchTab = (target: string) => {
if (target !== properties.activeTab)
handleChange({ id: 'activeTab', value: target });
Expand All @@ -31,10 +22,10 @@ const Home = ({ song, properties, handleChange }: any) => {
<div className="col-3 mt-10">
<button
className="card p-10"
onClick={() => switchTab('music')}
onClick={() => switchTab('environment')}
>
<h2 className="center-align">{MusicOutline()}</h2>
<p className="center-align">Music</p>
<h2 className="center-align">{License()}</h2>
<p className="center-align">Data</p>
</button>
<button
className="card p-10"
Expand All @@ -43,10 +34,6 @@ const Home = ({ song, properties, handleChange }: any) => {
<h2 className="center-align">{SettingsOutline()}</h2>
<p className="center-align">Settings</p>
</button>
<button className="card p-10">
<h2 className="center-align">-</h2>
<p className="center-align">Music</p>
</button>
</div>
</div>
);
Expand Down
13 changes: 11 additions & 2 deletions server/Spacefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ micros:
engine: nodejs16
primary: true
public: true
run: node index.js
presets:
env:
- name: NODE_ENV
Expand All @@ -20,7 +21,15 @@ micros:
default: https://edelweiss.deta.dev
- name: LINE_CHANNEL_ACCESS_TOKEN
default: your-line-channel-access-token
- name: LINE_DESTINATION_ID
default: your-line-destination-id
- name: LINE_CHANNEL_ACCESS_TOKEN_BACKUP
default: your-backup-line-channel-access-token
- name: WEBHOOK_URL
default: your-webhook-url
- name: ERROR_THREAD_ID
default: your-error-thread-id
- name: INCOMING_MESSAGE_THREAD_ID
default: your-incoming-message-thread-id
- name: INCOMING_REQUEST_THREAD_ID
default: your-incoming-request-thread-id
- name: SPACE_DETA_PROJECT_KEY
default: your-deta-project-key
Loading