Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
billy clark committed Oct 11, 2022
2 parents d5d32ad + 8a13be3 commit 699c82c
Show file tree
Hide file tree
Showing 27 changed files with 855 additions and 142 deletions.
2 changes: 1 addition & 1 deletion docker/deployment/db-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
spec:
containers:
- name: db
image: mongo:4.0
image: mongo:4.2
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ services:
command: sh -c "postconf -e 'default_transport = retry:no outbound email allowed' && /run.sh"

db:
image: mongo:4.0
image: mongo:4.2
container_name: lf-db
ports:
# exposed this to host for admin tools
Expand Down
2 changes: 1 addition & 1 deletion docker/ssl/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://caddyserver.com/docs/caddyfile
{
#debug
#auto_https disable_redirects
auto_https disable_redirects
}

localhost {
Expand Down
44 changes: 31 additions & 13 deletions docs/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Welcome! We're glad that you are interested in helping develop Language Forge.
- [Supported Development Environments](#supported-development-environments)
- [Project Setup](#project-setup)
- [Running the App Locally](#running-the-app-locally)
- [Mobile Device Testing on a Branch](#mobile-device-testing-on-a-branch)
- [Tests](#tests)
- [Running Playwright E2E Tests](#running-playwright-e2e-tests)
- [Running Protractor E2E Tests](#running-protractor-e2e-tests)
Expand Down Expand Up @@ -53,19 +54,36 @@ On Windows, the project should be opened with the [Remote - WSL](https://marketp
1. You should see a landing page, click "Login"
1. Use `admin` and `password` to login

> Sometimes there may be a need to hit the locally running app from a device other than the machine the app is running on. In order to do that, you'll need to do the following:
> 1. Figure out your local ip address
> 1. Access the app via http at that address
>
> On a Mac for example:
> ```
> ifconfig | grep broadcast
> inet 192.168.161.99 netmask 0xfffffc00 broadcast 192.168.163.255
> ```
>
> then hit `http://192.168.161.99` from your phone or other device on the same network.
>
> NOTE: disabling cache on your device may not be trivial, you'll either need to wipe the site settings on your device's browser or you'll need to do it via USB debugging.
Note: The application is accessible via HTTP or HTTPS. HTTPS is required for service-worker functionality.

### Mobile device testing on a branch ###

Sometimes there may be a need to hit the locally running app from a device other than the machine the app is running on. In order to do that, you'll need to do the following:
### If your machine's firewall is already configured for external access e.g. you use Docker Desktop ###

1. Figure out your local ip address
1. Access the app via http at that address

On a Mac for example:
```
ifconfig | grep broadcast
inet 192.168.161.99 netmask 0xfffffc00 broadcast 192.168.163.255
```

then hit `http://192.168.161.99` from your phone or other device on the same network.

NOTE: disabling cache on your device may not be trivial, you'll either need to wipe the site settings on your device's browser or you'll need to do it via USB debugging.

### If your machine's firewall is not configured for external port 80/443 access, you can use ngrok ###

[Here](https://gist.github.com/SalahHamza/799cac56b8c2cd20e6bfeb8886f18455) are instructions for installing ngrok on WSL (Linux Subsystem for Windows).
[Here](https://ngrok.com/download) are instructions for installing ngrok on Windows, Mac OS, Linux, or Docker.

Once ngrok is installed, run:
`./ngrok http http://localhost`
in a bash terminal. The same command with https://localhost may not work, so be careful to try http://localhost in particular.

ngrok will return two URLs, one http and one https, that contain what is being served in localhost. Test on another device using one or both of these URLs.

## Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
$filePath = self::mediaFilePath($folderPath, $fileNamePrefix, $fileName);
$moveOk = copy($fileName, $filePath);


//unlink the converted file from its temporary location
@unlink($fileName);

Expand All @@ -130,6 +131,7 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
$data = new MediaResult();
$data->path = $project->getAudioFolderPath($project->getAssetsRelativePath());
$data->fileName = $fileNamePrefix . '_' . $fileName; //if the file has been converted, $fileName = converted file
$data->fileSize = filesize($filePath);
$response->result = true;

//If this audio upload is replacing old audio, the previous file(s) for the entry are deleted from the assets
Expand Down Expand Up @@ -226,6 +228,7 @@ public static function uploadImageFile($projectId, $mediaType, $tmpFilePath)
$data = new MediaResult();
$data->path = $project->getImageFolderPath($project->getAssetsRelativePath());
$data->fileName = $fileNamePrefix . '_' . $fileName;
$data->fileSize = filesize($filePath);
$response->result = true;
} else {
$data = new ErrorResult();
Expand Down
6 changes: 5 additions & 1 deletion src/angular-app/bellows/shared/sound-player.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ export class SoundController implements angular.IController {

$onInit(): void {


this.slider = this.$element.find('.seek-slider').get(0) as HTMLInputElement;

//So that duration appears immediately once it is available
this.audioElement.addEventListener('durationchange', () => {
this.$scope.$apply();
});

this.audioElement.addEventListener('ended', () => {
this.$scope.$apply(() => {
if (this.playing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export class FieldAudioController implements angular.IController {
this.dcFilename = response.data.data.fileName;
this.showAudioUpload = false;
this.notice.push(this.notice.SUCCESS, 'File uploaded successfully.');
if(response.data.data.fileSize > 1000000){ //1 MB file size limit 2022-10
this.notice.push(this.notice.WARN, 'WARNING: Because the audio file - ' + response.data.data.fileName + ' - is larger than 1 MB, it will not be synced with FLEx.');
}
} else {
this.notice.push(this.notice.ERROR, response.data.data.errorMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export class FieldPictureController implements angular.IController {
if (isUploadSuccess) {
this.upload.progress = 100.0;
this.addPicture(response.data.data.fileName);
if(response.data.data.fileSize > 1000000){ //1 MB file size limit 2022-10
this.notice.push(this.notice.WARN, 'WARNING: Because the image file - ' + response.data.data.fileName + ' - is larger than 1 MB, it will not be synced with FLEx.');
}
this.upload.showAddPicture = false;
} else {
this.upload.progress = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/change-password.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test.describe('E2E Change Password app', () => {
const loginPage = new LoginPage(page);
await loginPage.loginAs(member.username, newPassword);
const pageHeader = new PageHeader(page);
await expect (pageHeader.myProjects.button).toBeVisible();
await expect(pageHeader.myProjects.button).toBeVisible(); // TODO: is flaky, fix it
});

});
Loading

0 comments on commit 699c82c

Please sign in to comment.