Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DevOps committed Feb 23, 2023
2 parents 9e60862 + 7eb5a12 commit f56a776
Show file tree
Hide file tree
Showing 49 changed files with 18,447 additions and 2,911 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: casualos
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# CasualOS Changelog

## V3.1.23

#### Date: 2/23/2023

### :rocket: Improvements

- Improved the records system to authenticate and authorize requests much more quickly than before.
- In order to take advantage of the improvements, you may need to request a new record key.
- Updated the multi-line code editor to color-code parenthesis, curly braces, and square brackets so it is easier to tell which pairs go together.

### :bug: Bug Fixes

- Fixed an issue where the multi-line editor could get stuck in an infinite loop while trying to resize itself to fit on the screen.
- Fixed an issue where tag masks would return the serialized version of a value instead of the computed version of the value.
- Tag masks are designed to work a little differently from regular tags since it is much more common for tag mask values to be set programmatically instead of entered by hand.
- This means that tag masks are designed to preserve the saved type as much as possible, unless it is clear that the value should be converted to a native type.
- As a result, only marked values are converted from their string value into a native value.
- For example, the string `"123"` will remain `"123"`, but the string `"🔢123"` will be converted to the number `123`. The same goes for other values like `"true"` and `"false"`.
- Possible marks are:
- Numbers: `🔢`
- Mods: `🧬`
- Dates: `📅`
- Vectors: `➡️`
- Rotations: `🔁`
- Fixed an issue where JSX syntax highlighting would fail if the script contained a return statement.
- Fixed an issue where empty `{}` expressions in JSX would cause compilation to fail.
- Fixed an issue where using `animateTag()` with a custom start time wouldn't work.
- Fixed an issue where autocomplete would not work on instances with a large number of listeners.

## V3.1.22

#### Date: 2/15/2023
Expand Down
4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"packages": [
"src/*"
],
"packages": ["src/*"],
"version": "3.1.22"
}
12,111 changes: 11,041 additions & 1,070 deletions package-lock.json

Large diffs are not rendered by default.

47 changes: 46 additions & 1 deletion src/aux-auth/server/MongoDBAuthStore.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RegexRule } from '@casual-simulation/aux-records';
import {
AddressType,
AuthLoginRequest,
Expand All @@ -13,15 +14,39 @@ export class MongoDBAuthStore implements AuthStore {
private _users: Collection<MongoDBAuthUser>;
private _loginRequests: Collection<MongoDBLoginRequest>;
private _sessions: Collection<MongoDBAuthSession>;
private _emailRules: Collection<MongoDBEmailRule>;
private _smsRules: Collection<MongoDBSmsRule>;

constructor(
users: Collection<MongoDBAuthUser>,
loginRequests: Collection<MongoDBLoginRequest>,
sessions: Collection<MongoDBAuthSession>
sessions: Collection<MongoDBAuthSession>,
emailRules: Collection<MongoDBEmailRule>,
smsRules: Collection<MongoDBSmsRule>
) {
this._users = users;
this._loginRequests = loginRequests;
this._sessions = sessions;
this._emailRules = emailRules;
this._smsRules = smsRules;
}

async listEmailRules(): Promise<RegexRule[]> {
const result = await this._emailRules.find().toArray();

return result.map((r) => ({
type: r.type,
pattern: r.pattern,
}));
}

async listSmsRules(): Promise<RegexRule[]> {
const result = await this._smsRules.find().toArray();

return result.map((r) => ({
type: r.type,
pattern: r.pattern,
}));
}

async findUser(userId: string): Promise<AuthUser> {
Expand Down Expand Up @@ -395,3 +420,23 @@ export interface MongoDBAuthSession {
*/
ipAddress: string;
}

/**
* Defines an interface that represents an email rule stored in MongoDB.
*/
export interface MongoDBEmailRule extends RegexRule {
/**
* The ID of the rule.
*/
_id: string;
}

/**
* Defines an interface that represents an sms rule stored in MongoDB.
*/
export interface MongoDBSmsRule extends RegexRule {
/**
* The ID of the rule.
*/
_id: string;
}
31 changes: 31 additions & 0 deletions src/aux-auth/server/MongoDBFileRecordsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
AddFileResult,
MarkFileRecordAsUploadedResult,
EraseFileStoreResult,
GetFileNameFromUrlResult,
} from '@casual-simulation/aux-records';
import { Collection } from 'mongodb';

Expand All @@ -21,6 +22,36 @@ export class MongoDBFileRecordsStore implements FileRecordsStore {
this._fileUploadUrl = fileUploadUrl;
}

getAllowedUploadHeaders(): string[] {
return ['record-name', 'content-type'];
}

async getFileNameFromUrl(
fileUrl: string
): Promise<GetFileNameFromUrlResult> {
if (fileUrl.startsWith(this._fileUploadUrl)) {
let fileName = fileUrl.slice(this._fileUploadUrl.length + 1);
if (fileName) {
return {
success: true,
recordName: null,
fileName,
};
}
return {
success: false,
errorCode: 'unacceptable_url',
errorMessage: 'The URL does not match an expected format.',
};
}

return {
success: false,
errorCode: 'unacceptable_url',
errorMessage: 'The URL does not match an expected format.',
};
}

async presignFileUpload(
request: PresignFileUploadRequest
): Promise<PresignFileUploadResult> {
Expand Down
Loading

0 comments on commit f56a776

Please sign in to comment.