Skip to content

Commit

Permalink
fix web interface, uploading etc
Browse files Browse the repository at this point in the history
# Conflicts:
#	include/handler_api.h

# Conflicts:
#	contrib/www/index.html
#	include/handler_api.h
  • Loading branch information
Claudio Götz committed Jul 28, 2023
1 parent 4711af7 commit d47beb8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
49 changes: 49 additions & 0 deletions contrib/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,10 @@ <h2>Client certificate upload</h2>
path: '/',
files: [],
selectedFiles: [],
<<<<<<< HEAD
tonies: [],
=======
>>>>>>> bcbad4f (fix web interface, uploading etc)
};
this.fetchFileIndex = this.fetchFileIndex.bind(this);
this.uploadFiles = this.uploadFiles.bind(this);
Expand All @@ -728,7 +731,10 @@ <h2>Client certificate upload</h2>
this.deleteSelectedFiles = this.deleteSelectedFiles.bind(this);
this.toggleFileSelection = this.toggleFileSelection.bind(this);
this.selectAllFiles = this.selectAllFiles.bind(this);
<<<<<<< HEAD
this.oggPlayerRef = React.createRef();
=======
>>>>>>> bcbad4f (fix web interface, uploading etc)
}

componentDidMount() {
Expand Down Expand Up @@ -840,7 +846,11 @@ <h2>Client certificate upload</h2>
const response = await fetch(api, {
method: 'POST',
headers: { 'Content-Type': 'text/plain' },
<<<<<<< HEAD
body: this.state.path + '/' + file.name,
=======
body: this.state.path + file.name,
>>>>>>> bcbad4f (fix web interface, uploading etc)
});

if (response.ok && await response.text() === 'OK') {
Expand All @@ -854,9 +864,13 @@ <h2>Client certificate upload</h2>
}
}

<<<<<<< HEAD
if (failedCount > 0) {
alert(`Deleted: ${deletedCount}, Failed: ${failedCount} `);
}
=======
alert(`Deleted: ${deletedCount}, Failed: ${failedCount} `);
>>>>>>> bcbad4f (fix web interface, uploading etc)
this.setState({ selectedFiles: [] });
this.fetchFileIndex(this.state.path); // Refresh files after delete
}
Expand Down Expand Up @@ -922,6 +936,7 @@ <h2>File Viewer</h2>
</pre>
)}

<<<<<<< HEAD
{this.state.files.map((file, index) => {
let maxLen = 24;
let filename = file.name.substring(0, maxLen);
Expand Down Expand Up @@ -1008,13 +1023,47 @@ <h2>File Viewer</h2>
})
}

=======
{this.state.files.map((file, index) => (
<pre key={index} style={{ fontFamily: 'monospace' }}>
<input
type="checkbox"
checked={this.state.selectedFiles.includes(file)}
onChange={() => this.toggleFileSelection(file)}
/>
{file.isDirectory ? (
<React.Fragment>
<a href="#" onClick={(e) => { e.preventDefault(); this.fetchFileIndex(`${this.state.path}${file.name}/`); }}>
{file.name}
</a >
<span>{' '.repeat(32 - file.name.length)}</span>
<span>{file.date}</span>
<span>{'-'.padStart(10)}</span>
</React.Fragment >
) : (
<React.Fragment>
<a href={`/content${this.state.path}${file.name}`} target="_blank" rel="noopener noreferrer">
{file.name}
</a >
<span>{' '.repeat(32 - file.name.length)}</span>
<span>{file.date.padEnd(10)}</span>
<span>{file.size.padStart(10)}</span>
</React.Fragment>
)
}
</pre >
))}
>>>>>>> bcbad4f (fix web interface, uploading etc)
</div >
);
}
}


<<<<<<< HEAD

=======
>>>>>>> bcbad4f (fix web interface, uploading etc)
class App extends React.Component {
constructor(props) {
super(props);
Expand Down
6 changes: 6 additions & 0 deletions include/handler_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ error_t handleApiSet(HttpConnection *connection, const char_t *uri, const char_t
error_t handleApiTrigger(HttpConnection *connection, const char_t *uri, const char_t *queryString);
error_t handleApiFileIndex(HttpConnection *connection, const char_t *uri, const char_t *queryString);
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> bcbad4f (fix web interface, uploading etc)
error_t handleApiFileUpload(HttpConnection *connection, const char_t *uri, const char_t *queryString);
error_t handleApiDirectoryCreate(HttpConnection *connection, const char_t *uri, const char_t *queryString);
error_t handleApiFileDelete(HttpConnection *connection, const char_t *uri, const char_t *queryString);
error_t handleApiDirectoryDelete(HttpConnection *connection, const char_t *uri, const char_t *queryString);
<<<<<<< HEAD
=======
error_t handleApiFileUpload(HttpConnection *connection, const char_t *uri, const char_t *queryString);
>>>>>>> e6efbc1 (passthrough queryString)
=======
>>>>>>> bcbad4f (fix web interface, uploading etc)

0 comments on commit d47beb8

Please sign in to comment.