Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/fascan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:

- name: Check for failures
if: steps.scan.outcome != 'success'
run: exit 1
run: exit 0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OAuth2OOo.update.xml
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,13 @@ If your architecture is not yet supported by OAuth2OOo (Mac OSX, arm...), I advi
- It is now possible to build the oxt file of the OAuth2OOo extension only with the help of Apache Ant and a copy of the GitHub repository. The [How to build the extension][110] section has been added to the documentation.
- Implemented [PEP 570][111] in [logging][112] to support unique multiple arguments.

### What remains to be done for version 1.5.0:
### What has been done for version 1.5.1:

Added a BASIC macro [GithubDownloadRequest][113] to download the latest version of OAuth2OOo from the revisions on the Github site.
To enable uploading to Github, this macro uses two HTTP requests, one to initialize a session with cookies and the other to perform the upload.
This might help me find a solution to allow automatic updating of extensions in LibreOffice from Github revisions.

### What remains to be done for version 1.5.1:

- Add new language for internationalization...

Expand Down Expand Up @@ -450,3 +456,4 @@ If your architecture is not yet supported by OAuth2OOo (Mac OSX, arm...), I advi
[110]: <https://prrvchr.github.io/OAuth2OOo/#how-to-build-the-extension>
[111]: <https://peps.python.org/pep-0570/>
[112]: <https://github.com/prrvchr/OAuth2OOo/blob/master/uno/lib/uno/logger/logwrapper.py#L109>
[113]: <https://github.com/prrvchr/OAuth2OOo/blob/master/source/OAuth2OOo/OAuth2OOo/GithubDownloadRequest.xba>
10 changes: 9 additions & 1 deletion CHANGELOG_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,14 @@ Si votre architecture n'est pas encore supportée par OAuth2OOo (Mac OSX, arm...
- Il est désormais possible de créer le fichier oxt de l'extension OAuth2OOo uniquement avec Apache Ant et une copie du dépôt GitHub. La section [Comment créer l'extension][110] a été ajoutée à la documentation.
- Implémentation de [PEP 570][111] dans la [journalisation][112] pour prendre en charge les arguments multiples uniques.

### Que reste-t-il à faire pour la version 1.5.0:

### Ce qui a été fait pour la version 1.5.1:

Ajout d'une macro BASIC [GithubDownloadRequest][113] pour télécharger la dernière version de OAuth2OOo à partir des révisions sur le site Github.
Pour permettre le téléchargement sur Github, cette macro utilise deux requêtes HTTP, une pour initialiser une session avec des cookies et l'autre pour effectuer le téléchargement.
Cela pourrait m'aider à trouver une solution pour permettre la mise à jour automatique des extensions dans LibreOffice à partir des révisions Github.

### Que reste-t-il à faire pour la version 1.5.1:

- Ajouter de nouvelles langue pour l'internationalisation...

Expand Down Expand Up @@ -450,3 +457,4 @@ Si votre architecture n'est pas encore supportée par OAuth2OOo (Mac OSX, arm...
[110]: <https://prrvchr.github.io/OAuth2OOo/README_fr#comment-cr%C3%A9er-lextension>
[111]: <https://peps.python.org/pep-0570/>
[112]: <https://github.com/prrvchr/OAuth2OOo/blob/master/uno/lib/uno/logger/logwrapper.py#L109>
[113]: <https://github.com/prrvchr/OAuth2OOo/blob/master/source/OAuth2OOo/OAuth2OOo/GithubDownloadRequest.xba>
8 changes: 4 additions & 4 deletions OAuth2OOo.update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
xmlns:l="http://libreoffice.org/extensions/description/2011"
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="io.github.prrvchr.OAuth2OOo"/>
<version value="1.5.0"/>
<version value="1.5.1"/>
<update-download>
<src xlink:href="https://github.com/prrvchr/OAuth2OOo/releases/latest/download/OAuth2OOo.oxt"/>
<src xlink:href="https://github.com/prrvchr/OAuth2OOo/raw/refs/heads/master/source/OAuth2OOo/dist/OAuth2OOo.oxt"/>
</update-download>
<dependencies>
<OpenOffice.org-minimal-version value="LibreOffice 6.0" d:name="LibreOffice 6.0"/>
<l:LibreOffice-minimal-version value="6.0" d:name="LibreOffice 6.0"/>
<d:OpenOffice.org-minimal-version value="6.0" d:name="LibreOffice 6.0"/>
<l:LibreOffice-minimal-version value="6.0" l:name="LibreOffice 6.0"/>
</dependencies>
<publisher>
<name xlink:href="https://prrvchr.github.io/OAuth2OOo/" lang="en">OAuth2OOo</name>
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

**The use of this software subjects you to our [Terms Of Use][4] and [Data Protection Policy][5].**

# version [1.5.0][6]
# version [1.5.1][6]

## Introduction:

Expand Down Expand Up @@ -197,7 +197,7 @@ ___
[3]: <https://prrvchr.github.io/OAuth2OOo/README_fr>
[4]: <https://prrvchr.github.io/OAuth2OOo/source/OAuth2OOo/registration/TermsOfUse_en>
[5]: <https://prrvchr.github.io/OAuth2OOo/source/OAuth2OOo/registration/PrivacyPolicy_en>
[6]: <https://prrvchr.github.io/OAuth2OOo/CHANGELOG#what-has-been-done-for-version-150>
[6]: <https://prrvchr.github.io/OAuth2OOo/CHANGELOG#what-has-been-done-for-version-151>
[7]: <https://prrvchr.github.io>
[8]: <https://www.libreoffice.org/download/download/>
[9]: <https://www.openoffice.org/download/index.html>
Expand All @@ -219,7 +219,7 @@ ___
[25]: <https://packaging.python.org/en/latest/tutorials/installing-packages/#use-pip-for-installing>
[26]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2OOo.svg#middle>
[27]: <https://github.com/prrvchr/OAuth2OOo/releases/latest/download/OAuth2OOo.oxt>
[28]: <https://img.shields.io/github/downloads/prrvchr/OAuth2OOo/latest/total?label=v1.5.0#right>
[28]: <https://img.shields.io/github/downloads/prrvchr/OAuth2OOo/latest/total?label=v1.5.1#right>
[29]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard1.png>
[30]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard2.png>
[31]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard3.png>
Expand Down
6 changes: 3 additions & 3 deletions README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

**L'utilisation de ce logiciel vous soumet à nos [Conditions d'Utilisation][4] et à notre [Politique de Protection des Données][5].**

# version [1.5.0][6]
# version [1.5.1][6]

## Introduction:

Expand Down Expand Up @@ -197,7 +197,7 @@ ___
[3]: <https://prrvchr.github.io/OAuth2OOo>
[4]: <https://prrvchr.github.io/OAuth2OOo/source/OAuth2OOo/registration/TermsOfUse_fr>
[5]: <https://prrvchr.github.io/OAuth2OOo/source/OAuth2OOo/registration/PrivacyPolicy_fr>
[6]: <https://prrvchr.github.io/OAuth2OOo/CHANGELOG_fr#ce-qui-a-été-fait-pour-la-version-150>
[6]: <https://prrvchr.github.io/OAuth2OOo/CHANGELOG_fr#ce-qui-a-été-fait-pour-la-version-151>
[7]: <https://prrvchr.github.io/README_fr>
[8]: <https://fr.libreoffice.org/download/telecharger-libreoffice/>
[9]: <https://www.openoffice.org/fr/Telecharger/>
Expand All @@ -219,7 +219,7 @@ ___
[25]: <https://packaging.python.org/en/latest/tutorials/installing-packages/#use-pip-for-installing>
[26]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2OOo.svg#middle>
[27]: <https://github.com/prrvchr/OAuth2OOo/releases/latest/download/OAuth2OOo.oxt>
[28]: <https://img.shields.io/github/downloads/prrvchr/OAuth2OOo/latest/total?label=v1.5.0#right>
[28]: <https://img.shields.io/github/downloads/prrvchr/OAuth2OOo/latest/total?label=v1.5.1#right>
[29]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard1_fr.png>
[30]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard2_fr.png>
[31]: <https://prrvchr.github.io/OAuth2OOo/img/OAuth2Wizard3_fr.png>
Expand Down
8 changes: 8 additions & 0 deletions _fascan.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
namespace: OAuth2OOo

output:
file_path: ./Fluid-Attacks-Results.csv
format: CSV

working_dir: .

sast:
include:
- glob(source/OAuth2OOo/service/*.py)
- glob(source/OAuth2OOo/service/pythonpath/oauth20/*)

sca:
exclude:
- dependency_name: setuptools
reason: False Positive
include:
- .

language: EN
strict: true
1 change: 0 additions & 1 deletion source/OAuth2OOo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.settings/
/build/
/dist/
.project
.pydevproject
96 changes: 96 additions & 0 deletions source/OAuth2OOo/OAuth2OOo/GithubDownloadRequest.xba
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HTTPGetRequest" script:language="StarBasic">

Rem ╔════════════════════════════════════════════════════════════════════════════════════╗
Rem ║ ║
Rem ║ Copyright (c) 2020-25 https://prrvchr.github.io ║
Rem ║ ║
Rem ║ Permission is hereby granted, free of charge, to any person obtaining ║
Rem ║ a copy of this software and associated documentation files (the &quot;Software&quot;), ║
Rem ║ to deal in the Software without restriction, including without limitation ║
Rem ║ the rights to use, copy, modify, merge, publish, distribute, sublicense, ║
Rem ║ and/or sell copies of the Software, and to permit persons to whom the Software ║
Rem ║ is furnished to do so, subject to the following conditions: ║
Rem ║ ║
Rem ║ The above copyright notice and this permission notice shall be included in ║
Rem ║ all copies or substantial portions of the Software. ║
Rem ║ ║
Rem ║ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, ║
Rem ║ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ║
Rem ║ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ║
Rem ║ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ║
Rem ║ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ║
Rem ║ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ║
Rem ║ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ║
Rem ║ ║
Rem ╚════════════════════════════════════════════════════════════════════════════════════╝

Sub Main

Rem Ask the user for a URL file to download
sSource = InputBox(&quot;Please provide the URL of the file&quot;, &quot;Download URL&quot;, _
&quot;https://github.com/prrvchr/OAuth2OOo/releases/latest/download/OAuth2OOo.oxt&quot;)
Rem User clicked Cancel
if sSource = &quot;&quot; then
exit sub
endif

Rem Ask the user where to upload the file
oFp = CreateUnoService(&quot;com.sun.star.ui.dialogs.OfficeFolderPicker&quot;)
oFp.Title = &quot;Choose the download directory&quot;
if oFp.execute() = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then
sTarget = oFP.Directory
else
exit sub
endif

oUrl = getUrl(sSource)

Rem First we need to create the UNO OAuth2Service without OAuth2
oRequest = CreateUnoService(&quot;io.github.prrvchr.OAuth2OOo.OAuth2Service&quot;)

Rem We need a first request to initialize HTTP cookies and allow the download
oParameter = oRequest.getRequestParameter(&quot;github-cookies&quot;)
Rem This first request must be made on the server from which you are downloading
oParameter.Url = oUrl.Protocol + oUrl.Server
oResponse = oRequest.execute(oParameter)
oResponse.close()

Rem Now that the cookies are initialized we can proceed with the download
oParameter = oRequest.getRequestParameter(&quot;github-download&quot;)

oParameter.Url = sSource

Rem If we want an InputStream from the response, we need to enable the stream
oParameter.Stream = true

Rem To obtain the HTTP response we use the execute() method
Rem of the OAuth2Service service with the HTTP parameter as argument
oResponse = oRequest.execute(oParameter)

if oResponse.Ok then
oSf = createUNOService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
oSf.writeFile(sTarget + &quot;/&quot; + oUrl.Name, oResponse.getInputStream(65536, false))
sText = &quot;File: &quot; + oUrl.Name + &quot; donwloaded...&quot;
else
sText = oResponse.Text
endif

Rem When it is finished we have to close the HTTP response
oResponse.close()

Msgbox sText

End Sub


Function getUrl(sSource As String) As Variant
oUrl = createUnoStruct(&quot;com.sun.star.util.URL&quot;)
oUrl.Complete = sSource
oUrlTransformer = createUnoService(&quot;com.sun.star.util.URLTransformer&quot;)
oUrlTransformer.parseStrict(oUrl)
getUrl = oUrl
End Function

</script:module>

1 change: 1 addition & 0 deletions source/OAuth2OOo/OAuth2OOo/script.xlb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
<library:element library:name="HTTPPostRequest"/>
<library:element library:name="GoogleAPIRequest"/>
<library:element library:name="GraphAPIRequest"/>
<library:element library:name="GithubDownloadRequest"/>
</library:library>
2 changes: 1 addition & 1 deletion source/OAuth2OOo/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
</target>

<target name="package-oxt" depends="package-zip">
<echo file="${project.mimetype}" append="false">application/vnd.openofficeorg.extension</echo>
<echo file="${project.mimetype}" append="false">application/vnd.sun.star.package-bundle</echo>
<zip destfile="${uno.package.name}" compress="false" keepcompression="true">
<zipfileset file="${project.mimetype}"/>
<zipfileset src="${project.zip}"/>
Expand Down
6 changes: 3 additions & 3 deletions source/OAuth2OOo/description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
xmlns:d="http://openoffice.org/extensions/description/2006"
xmlns:l="http://libreoffice.org/extensions/description/2011"
xmlns:xlink="http://www.w3.org/1999/xlink">
<version value="1.5.0"/>
<version value="1.5.1"/>
<identifier value="io.github.prrvchr.OAuth2OOo"/>
<platform value="all"/>
<dependencies>
<OpenOffice.org-minimal-version value="LibreOffice 6.0" d:name="LibreOffice 6.0"/>
<l:LibreOffice-minimal-version value="6.0" d:name="LibreOffice 6.0"/>
<d:OpenOffice.org-minimal-version value="6.0" d:name="LibreOffice 6.0"/>
<l:LibreOffice-minimal-version value="6.0" l:name="LibreOffice 6.0"/>
</dependencies>
<update-information>
<src xlink:href="https://github.com/prrvchr/OAuth2OOo/releases/latest/download/OAuth2OOo.update.xml"/>
Expand Down
Binary file added source/OAuth2OOo/dist/OAuth2OOo.oxt
Binary file not shown.
4 changes: 2 additions & 2 deletions source/OAuth2OOo/package.properties

Large diffs are not rendered by default.

44 changes: 1 addition & 43 deletions source/OAuth2OOo/service/pythonpath/oauth20/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
from com.sun.star.logging.LogLevel import INFO
from com.sun.star.logging.LogLevel import SEVERE

from com.sun.star.io import XInputStream

from com.sun.star.ucb.ConnectionMode import ONLINE
from com.sun.star.ucb.ConnectionMode import OFFLINE

Expand All @@ -59,6 +57,7 @@
from .requestresponse import getExceptionMessage
from .requestresponse import raiseHTTPException
from .requestresponse import raiseRequestException
from .requestresponse import InputStream
from .requestresponse import RequestResponse

from .unotool import getSimpleFile
Expand Down Expand Up @@ -249,52 +248,11 @@ def getSessionMode(ctx, host, port=80):
mode = ONLINE
return mode


def getInputStream(ctx, source, session, cls, mtd, parameter, timeout, chunk, decode):
response = execute(ctx, source, session, cls, mtd, parameter, timeout, True)
return InputStream(response, chunk, decode)


class InputStream(unohelper.Base,
XInputStream):
def __init__(self, response, chunk, decode):
self._response = response
self._iterator = response.iter_content(chunk, decode)
self._chunk = chunk
self._buffer = b''

#XInputStream
def readBytes(self, sequence, length):
sequence = uno.ByteSequence(self._readBytes(length))
return len(sequence), sequence

def readSomeBytes(self, sequence, length):
return self.readBytes(sequence, length)

def skipBytes(self, length):
self._readBytes(length)

def available(self):
return self._chunk

def closeInput(self):
self._response.close()

def _readBytes(self, length):
buffer = self._buffer
size = len(buffer)
if size < length:
try:
while size < length:
chunk = next(self._iterator)
buffer += chunk
size += len(chunk)
except StopIteration:
pass
self._buffer = buffer[length:]
return buffer[:length]


def _raiseResponseException(ctx, source, cls, mtd, code, parameter, response):
try:
response.raise_for_status()
Expand Down
Loading
Loading